request->params(['quota_type']); $statInfo = app()->make(ExchangeQuotaRepository::class)->getStat($params); $quotaType = $params['quota_type'] ?? 1; $quotaTitle = $quotaType == 5 ? '积分' : '额度'; $data = [ ['className' => 'el-icon-coin','count' => $statInfo['sum_total_quota'],'field' => '分','name' => '平台总'.$quotaTitle], ['className' => 'el-icon-coin','count' => $statInfo['sum_use_quota'],'field' => '分','name' => '平台已使用'.$quotaTitle], ['className' => 'el-icon-coin','count' => $statInfo['sum_surplus_quota'],'field' => '分','name' => '平台剩余'.$quotaTitle], ['className' => 'el-icon-coin','count' => $statInfo['sum_freeze_quota'],'field' => '分','name' => '平台冻结'.$quotaTitle], // ['className' => 'el-icon-coin','count' => $statInfo['sum_people_num'],'field' => '分','name' => '参与人数'], ]; return app('json')->success($data); } /** * Common: 额度信息 - 额度持有信息 * Author: wu-hui * Time: 2024/01/11 9:59 * @return mixed */ public function quotaList(){ [$page, $limit] = $this->getPage(); $params = $this->request->params(['uid','quota_type']); $data = app()->make(ExchangeQuotaRepository::class)->getList((array)$params,(int)$page,(int)$limit); return app('json')->success($data); } /** * Common: 额度信息 - 变更记录 * Author: wu-hui * Time: 2024/01/11 10:02 * @return mixed */ public function quotaRecordList(){ [$page, $limit] = $this->getPage(); $params = $this->request->params(['uid','quota_type']); $data = app()->make(ExchangeQuotaRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit); return app('json')->success($data); } /** * Common: 酒水卡积分 - 统计 * Author: wu-hui * Time: 2024/01/12 17:38 * @return mixed */ public function integralTitle(){ $model = new User(); $data = [ ['className' => 'el-icon-coin','count' => $model->sum('exchange_integral'),'field' => '分','name' => '总酒水卡积分'], ]; return app('json')->success($data); } /** * Common: 酒水卡积分 - 额度持有信息 * Author: wu-hui * Time: 2024/01/12 17:39 * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function integralList(){ [$page, $limit] = $this->getPage(); $params = $this->request->params(['uid']); $query = (new User()) ->when((int)$params['uid'] > 0,function($query) use ($params){ $query->where('uid', (int)$params['uid']); }) ->where('exchange_integral','>',0) ->order('create_time DESC,uid DESC'); $count = $query->count(); $list = $query->page($page,$limit)->select(); return app('json')->success(compact('count','list')); } /** * Common: 酒水卡积分 - 变更记录 * Author: wu-hui * Time: 2024/01/12 17:40 * @return mixed */ public function integralRecordList(){ [$page, $limit] = $this->getPage(); $params = $this->request->params(['uid','source']); $data = app()->make(ExchangeIntegralRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit); return app('json')->success($data); } /** * Common: 提货点编辑 * Author: wu-hui * Time: 2024/01/14 10:53 * @return mixed */ public function pickupPointEdit(){ // 参数获取 $params = $this->request->params(['id','title','address','is_show','uid_list','lat','lng']); if(empty($params['title'])) return app('json')->fail('请输入提货点名称!'); if(empty($params['address'])) return app('json')->fail('请输入提货点地址!'); if(!is_array($params['uid_list']) || count($params['uid_list']) <= 0) return app('json')->fail('请至少选择一个负责人!'); if(empty($params['lat']) || empty($params['lng'])) return app('json')->fail('请选择经纬度!'); // 判断:地址是否已经存在 $isHave = ExchangePickupPoint::where('address',$params['address']) ->when((int)$params['id'] > 0,function($query) use ($params){ $query->where('id','<>',$params['id']); }) ->count(); if($isHave > 0) return app('json')->fail('地址已经存在,请勿重复添加!'); // 信息添加 || 编辑 app()->make(ExchangePickupPointRepository::class)->editInfo($params); return app('json')->success('success'); } /** * Common: 提货点列表 * Author: wu-hui * Time: 2024/01/14 10:53 * @return mixed */ public function pickupPointList(){ [$page, $limit] = $this->getPage(); $params = $this->request->params(['uid','address']); $data = app()->make(ExchangePickupPointRepository::class)->getList((array)$params,(int)$page,(int)$limit); return app('json')->success($data); } /** * Common: 提货点信息 * Author: wu-hui * Time: 2024/01/14 11:30 * @return mixed */ public function pickupPointInfo($id){ $data = app()->make(ExchangePickupPointRepository::class)->getInfo($id); return app('json')->success($data); } /** * Common: 提货记录 * Author: wu-hui * Time: 2024/01/14 18:21 * @return mixed */ public function pickupPointRecord(){ [$page, $limit] = $this->getPage(); $params = $this->request->params(['uid','address', 'staff_uid']); $data = app()->make(ExchangePickupRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit); return app('json')->success($data); } /** * Common: 配置信息 - 修改 * Author: wu-hui * Time: 2024/07/01 10:15 * @return mixed */ public function setConfig(){ $config = $this->request->params([ ['quota_integral_rate',0],// 赠送比例 ['quota_integral_diff_rate',0],// 补差折扣,以原价的百分之多少进行现金支付 ['quota_integral_upgrade_switch',0],// 是否开启消费升级 ['quota_integral_upgrade_money',0],// 升级分销商要求金额 ['quota_integral_upgrade_level',0],// 升级后等级 ]); // 保存信息 $cid = app()->make(ConfigClassifyRepository::class)->getConfigClassifyKeyById('quota_config', '额度与积分配置'); if (!$cid) return app('json')->fail('保存失败'); app()->make(ConfigValueRepository::class)->setFormData($config,$this->request->merId()); return app('json')->success('保存成功'); } /** * Common: 配置信息 - 获取 * Author: wu-hui * Time: 2024/07/01 10:15 * @return mixed */ public function getConfig(){ $config = app()->make(ExchangeQuotaRepository::class)->getConfig(); return app('json')->success($config); } }