1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\admin\service\added;
- use app\model\Member;
- use app\model\RuleAddedComponent;
- use app\model\SysDept;
- class AddedService{
- public static function generateWriteOffData($params){
- /*
- {
- "charge": {
- "charge_amount": 1,
- "charge_content": "",
- "charge_user_id": "UR202404281156462unjhlct",
- "charge_premises": "万悦康养"
- },
- "member_id": "MR20240320105229O2MGKG",
- "quota_code": "8636686902",
- "rule_added_id": "RA0000000000000059LRGB8R",
- "member_role_id": "MR0000000000000058ZAZVBF",
- "member_quota_id": "MQ20240604175800GDW66M",
- "rule_added_component_id": "4",
- "rule_added_component_classify": "SERVICE"
- }
- */
- // $premises = SysDept::where('dept_id',);
- $component = RuleAddedComponent::where('rule_added_component_id',$params['component_id'])
- ->select('rule_added_component_id','join_component_rule_added_id','rule_added_component_classify')
- ->first();
- $member = Member::where('member_id',$params['member_id'])
- ->select('member_id','join_member_role_id')
- ->first();
- return [
- 'charge'=>[
- 'charge_amount'=>1,
- 'charge_content'=>$params['remark'] ?? '',
- 'charge_user_id'=>$params['write_off_member_id'],
- 'charge_premises'=>$params['dept_premises_id'],
- 'charge_write_off_time'=>$params['times'],
- 'charge_waiter' => $params['charge_waiter'] ?? ''
- ],
- 'member_id'=>$params['member_id'],
- 'quota_code'=>random_string(10,'number'),
- 'rule_added_id' => $component->join_component_rule_added_id,
- 'member_role_id'=>$member->join_member_role_id,
- 'rule_added_component_id'=>$params['component_id'],
- 'rule_added_component_classify'=>$component->rule_added_component_classify ?? '',
- ];
- }
- }
|