title = '商户返点设置'; $this->mid = input('mid'); $query = $this->_query($this->table); $query->equal('mid,pid,status')->dateBetween('create_at'); $query->order('num asc')->page(); } /** * 数据列表处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _page_filter(&$data) { foreach ($data as &$vo) { $merchant = $this->app->db->name('merchant_list')->where(['id' => $vo['mid']])->find(); $vo['mname'] = $merchant['name']; $product = $this->app->db->name('channel_product')->where(['key' => $vo['product_key']])->find(); $vo['product_name'] = $product['name']; $vo['product_key'] = $product['key']; } } /** * 表单数据处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _form_filter(&$data) { $this->mid = input('mid'); $this->relation = $this->app->db->name('merchant_relation')->where(['mid' => $this->mid])->select()->toArray(); if ($this->relation) { foreach ($this->relation as $k => $v) { $product = $this->app->db->name('channel_product')->where(['id' => $v['pid']])->find(); $this->relation[$k]['product_name'] = $product['name']; $this->relation[$k]['product_key'] = $product['key']; } } } protected function _form_result($id, $data) { } /** * 添加商户 * @auth true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function add() { $this->_applyFormToken(); $this->_form($this->table, 'form'); } /** * 编辑商户 * @auth true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function edit() { $this->_applyFormToken(); $this->_form($this->table, 'form'); } /** * 删除渠道商品 * @auth true * @throws \think\db\exception\DbException */ public function remove() { $this->_delete($this->table); } }