AddedService.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\admin\service\added;
  3. use app\model\Member;
  4. use app\model\RuleAddedComponent;
  5. use app\model\SysDept;
  6. class AddedService{
  7. public static function generateWriteOffData($params){
  8. /*
  9. {
  10. "charge": {
  11. "charge_amount": 1,
  12. "charge_content": "",
  13. "charge_user_id": "UR202404281156462unjhlct",
  14. "charge_premises": "万悦康养"
  15. },
  16. "member_id": "MR20240320105229O2MGKG",
  17. "quota_code": "8636686902",
  18. "rule_added_id": "RA0000000000000059LRGB8R",
  19. "member_role_id": "MR0000000000000058ZAZVBF",
  20. "member_quota_id": "MQ20240604175800GDW66M",
  21. "rule_added_component_id": "4",
  22. "rule_added_component_classify": "SERVICE"
  23. }
  24. */
  25. // $premises = SysDept::where('dept_id',);
  26. $component = RuleAddedComponent::where('rule_added_component_id',$params['component_id'])
  27. ->select('rule_added_component_id','join_component_rule_added_id','rule_added_component_classify')
  28. ->first();
  29. $member = Member::where('member_id',$params['member_id'])
  30. ->select('member_id','join_member_role_id')
  31. ->first();
  32. return [
  33. 'charge'=>[
  34. 'charge_amount'=>1,
  35. 'charge_content'=>$params['remark'] ?? '',
  36. 'charge_user_id'=>$params['write_off_member_id'],
  37. 'charge_premises'=>$params['dept_premises_id'],
  38. 'charge_write_off_time'=>$params['times'],
  39. 'charge_waiter' => $params['charge_waiter'] ?? ''
  40. ],
  41. 'member_id'=>$params['member_id'],
  42. 'quota_code'=>random_string(10,'number'),
  43. 'rule_added_id' => $component->join_component_rule_added_id,
  44. 'member_role_id'=>$member->join_member_role_id,
  45. 'rule_added_component_id'=>$params['component_id'],
  46. 'rule_added_component_classify'=>$component->rule_added_component_classify ?? '',
  47. ];
  48. }
  49. }