企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
文件路径:shop/controllers/Seller/Shop/ContractCtl.php 流程:加入->平台审核->审核通过 一、消费者保障服务 * 七天退货 * 品质承诺 * 破损寄补 * 极速物流 * 服务状态(开启、关闭) 参数:contract_type_state 模型:shop/models/shop/ContractTypeModel.php ~~~ public static $state = array( '1' => 'open', '2' => 'close', ); ~~~ * 保障服务申请状态(未加入、已加入、加入审核中、退出审核) 模型:shop/models/shop/class Shop_ContractModel extends Shop_Contract.php ~~~ const CONTRACT_INUSE = 1; const CONTRACT_UNUSE = 2; const CONTRACT_JOIN = 1; const CONTRACT_QUIT = 2; public static $state = array( '1' => 'inuse', '2' => 'unuse', ); public function getContractList($cond_row = array(), $order_row = array(), $page = 1, $rows = 100) { $data = $this->listByWhere($cond_row, $order_row, $page, $rows); $Shop_ContractLogModel = new Shop_ContractLogModel(); foreach ($data['items'] as $key => $val) { $log = $Shop_ContractLogModel->getOneLog($val['contract_log_id']); $data['items'][$key]['log_state'] = $log['contract_log_state_etext']; if ($val['contract_state'] == self::CONTRACT_INUSE) { if ($val['contract_use_state'] == self::CONTRACT_JOIN) { if ($log['contract_log_state'] == Shop_ContractLogModel::LOG_STATE_PASS) { $data['items'][$key]['contract_state_text'] = __('已加入'); } else { $data['items'][$key]['contract_state_text'] = __('加入审核中'); } } elseif ($val['contract_use_state'] == self::CONTRACT_QUIT) { if ($log['contract_log_state'] == Shop_ContractLogModel::LOG_STATE_PASS) { $data['items'][$key]['contract_state_text'] = __('未加入'); } else { $data['items'][$key]['contract_state_text'] = __('退出审核中'); } } } elseif ($val['contract_state'] == self::CONTRACT_UNUSE) { $data['items'][$key]['contract_state_text'] = __('永久禁止使用'); } } return $data; } ~~~ 视图:根据URL获得参数act的值,判断视图 ~~~ if ($act == "detail") { $data = $this->detail(); $this->view->setMet('detail'); } include $this->view->getView(); ~~~ 1.加入活动 * 控制器:shop/controllers/Seller/Shop/ContractCtl.php * 视图:shop/views/default/Seller/Shop/ContractCtl/index.php 加入表单验证:`$("[nc_type='applybtn']").click(function (){})` 方法:joinContract() ~~~ $contract = $this->shopContractModel->getOneByWhere($cond_row); if (empty($contract)) { $field_row['contract_type_id'] = $contract_type_id; $field_row['contract_type_name'] = $data['contract_type_name']; $field_row['shop_id'] = Perm::$shopId; $field_row['shop_name'] = $shop['shop_name']; $field_row['contract_use_state'] = Shop_ContractModel::CONTRACT_JOIN; $contract_id = $this->shopContractModel->addContract($field_row, true); check_rs($contract_id, $rs_row); } else { $contract_id = $contract['contract_id']; $field_row['contract_use_state'] = Shop_ContractModel::CONTRACT_JOIN; $flag = $this->shopContractModel->editContract($contract_id, $field_row); check_rs($flag, $rs_row); } ~~~ * 平台审核加入: 控制器:shop/controllers/Api/Operation/ContractCtl.php 视图:shop_admin/views/default/Operation/ContractCtl/log.php JS:shop_admin/static/default/js/controllers/operation/contract_list.js 2.退出活动 * 控制器:shop/controllers/Seller/Shop/ContractCtl.php * 视图:shop/views/default/Seller/Shop/ContractCtl/index.php 表单验证:`$("[nc_type='quitbtn']").click(function (){})` 方法:quitContract() `$flag = $this->shopContractModel->editContract($contract_id, $clog_row);` * 平台审核退出: 控制器:shop/controllers/Api/Operation/ContractCtl.php 视图:shop_admin/views/default/Operation/ContractCtl/log.php JS:shop_admin/static/default/js/controllers/operation/contract_list.js 3.查看服务详情 视图:shop/views/default/Seller/Shop/ContractCtl/detail.php 服务详情: ~~~ $data['contract_type'] = $this->shopContractTypeModel->getOne($cond_row['contract_type_id']); $contract = $this->shopContractModel->getOneByWhere($cond_row); $data['contract'] = $this->shopContractModel->getOneContract($contract['contract_id']); $data['log'] = $this->shopContractLogModel->getContractLogList($cond_row, array('contract_log_date' => 'DESC'), $page, $rows); ~~~