merchantId)->find(); $lecturer = AgentUser::where('id', $this->merchantInfo['id'])->field('label,explain,introduction')->find(); $lecturer['introduction'] = htmlspecialchars_decode($lecturer['introduction']); $this->assign(['merchat' => json_encode($merchant), 'lecturer' => json_encode($lecturer)]); return $this->fetch(); } /** * 保存商户资料 */ public function edit_merchant() { $post = parent::postMore([ ['mer_name', ''], ['mer_email', ''], ['mer_phone', ''], ['mer_address', ''], ['mer_avatar', ''], ['mer_info', ''], ['estate', 0], ['card_id', ''], ['bank', ''], ['bank_number', ''], ['bank_name', ''], ['bank_address', ''], ['label', []], ['explain', ''] ]); $data['label'] = json_encode($post['label']); $data['explain'] = $post['explain']; $data['introduction'] = htmlspecialchars($post['mer_info']); $data['lecturer_name'] = $post['mer_name']; $data['lecturer_head'] = $post['mer_avatar']; $data['phone'] = $post['mer_phone']; Merchant::beginTrans(); try { unset($post['label'], $post['explain']); Merchant::edit($post, $this->merchantId, 'id'); if (!$post['estate']) { Special::where(['is_del' => 0, 'mer_id' => $this->merchantId])->update(['is_show' => 0]); DownloadModel::where(['is_del' => 0, 'mer_id' => $this->merchantId])->update(['is_show' => 0]); ProductModel::where(['is_del' => 0, 'mer_id' => $this->merchantId])->update(['is_show' => 0]); EventRegistrationModel::where(['is_del' => 0, 'mer_id' => $this->merchantId])->update(['is_show' => 0]); $data['is_show'] = 0; Lecturer::edit($data, $this->merchantInfo['lecturer_id'], 'id'); } else { $data['is_show'] = 1; Lecturer::edit($data, $this->merchantInfo['lecturer_id'], 'id'); } Merchant::commitTrans(); return JsonService::successful('保存成功'); } catch (\Exception $e) { Merchant::rollbackTrans(); return JsonService::fail($e->getMessage()); } } }