success($result); } public function setAffiliateConfig(){ $data = input('post.'); $dataJson = json_encode($data); try{ Db::name('shop_config')->where('code','affiliate')->update(['value'=>$dataJson]); }catch(\Exception $e){ return $this->error('操作失败'); } return $this->success('操作成功'); } public function getAffiliateList(){ $page = input('page'); $pageSize = input('pageSize'); $do = Db::name('affiliate_log') ->alias('al') ->leftjoin('order_info oi','oi.order_id = al.order_id') ->field('al.*,oi.order_sn,oi.order_amount'); $rtn = $do ->page($page, $pageSize) ->order('log_id', 'desc') ->select() ->toArray(); if (!$rtn) { $rtn = []; } foreach ($rtn as $key => $val) { $rtn[$key]['time'] = date('Y-m-d H:i:s', $val['time']); } $rtn = [ 'total' => $do->count(), 'data' => $rtn ]; return $this->Success($rtn); } public function delAffiliateLog(){ $id=input('id'); try{ Db::name('affiliate_log')->where('log_id',$id)->delete(); }catch(\Exception $e){ return $this->Errot('删除失败'); } return $this->Success('删除成功'); } }