selffetch_shop_id = $params['selffetch_shop_id']; $selffetch_verifier->user_id = $params['user_id']; $selffetch_verifier->sn = create_number_sn((new SelffetchVerifier()),'sn',8); $selffetch_verifier->name = $params['name']; $selffetch_verifier->mobile = $params['mobile']; $selffetch_verifier->status = $params['status']; return $selffetch_verifier->save(); } /** * @notes 编辑核销员 * @param $params * @return bool * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2021/8/11 7:37 下午 */ public function edit($params) { $selffetch_verifier = SelffetchVerifier::find($params['id']); $selffetch_verifier->selffetch_shop_id = $params['selffetch_shop_id']; $selffetch_verifier->user_id = $params['user_id']; $selffetch_verifier->name = $params['name']; $selffetch_verifier->mobile = $params['mobile']; $selffetch_verifier->status = $params['status']; return $selffetch_verifier->save(); } /** * @notes 核销员详情 * @param $params * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2021/8/11 7:49 下午 */ public function detail($params) { $info = SelffetchVerifier::alias('sv') ->join('user u', 'sv.user_id = u.id') ->join('selffetch_shop ss', 'ss.id = sv.selffetch_shop_id') ->field('sv.*,u.nickname,u.avatar,ss.name as shop_name') ->where('sv.id',$params['id']) ->find() ->toArray(); $info['avatar'] = trim($info['avatar']) ? FileService::getFileUrl($info['avatar']) : ''; return $info; } /** * @notes 修改核销员状态 * @param $params * @return bool * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2021/8/11 8:21 下午 */ public function status($params) { $selffetch_verifier = SelffetchVerifier::find($params['id']); $selffetch_verifier->status = $params['status']; return $selffetch_verifier->save(); } /** * @notes 删除核销员 * @param $params * @return bool * @author ljj * @date 2021/8/11 8:27 下午 */ public function del($params) { return SelffetchVerifier::destroy($params['id']); } }