diff --git a/addon/fenxiao/api/controller/Order.php b/addon/fenxiao/api/controller/Order.php index adaa58dc..23280b4f 100644 --- a/addon/fenxiao/api/controller/Order.php +++ b/addon/fenxiao/api/controller/Order.php @@ -16,6 +16,7 @@ use addon\fenxiao\model\FenxiaoOrder as FenxiaoOrderModel; use addon\fenxiao\model\Fenxiao; use think\Exception; use think\facade\Log; +use app\model\order\Order as BaseOrder; /** * 分销订单 @@ -118,14 +119,45 @@ class Order extends BaseApi return $this->response(event("DaySettlement")); } - public function testOrderPay(){ - try{ - event("OrderPay",model('order')->getInfo([['order_id','=',220]])); - Log::debug('11111111111111111111111111111'); - }catch(Exception $exception){ - $this->response($exception->getMessage()); - } + public function testAreaMonthlyReward(){ + event("AreaMonthlyReward"); return $this->response([]); } + public function testPointexchangeOrderPayNotify(){ + return $this->response(event("PointexchangeOrderPayNotify",['out_trade_no'=>'16768593884624691000'])); + + $order = new BaseOrder; + + // return $this->response( $order->addOrderLog(["id" => 265, + // "site_id" => 1, + // "out_trade_no" => "16768593884624691000", + // "pay_type" => "POINT", + // "trade_no" => "", + // "pay_no" => "", + // "pay_body" => "测试商品 【商品】", + // "pay_detail" => "测试商品 【商品】", + // "pay_money" => "0.00", + // "pay_addon" => "", + // "pay_voucher" => "", + // "pay_status" => 2, + // "return_url" => "", + // "event" => "PointexchangeOrderPayNotify", + // "mch_info" => "", + // "create_time" => 1676859389, + // "pay_time" => 1676859389, + // "balance" => "0.00", + // "balance_money" => "0.00", + // "member_id" => 0, + // "pay_json" => "", + // "order_id" => 262, + // "action" => "商家对订单进行了线下支付", + // "order_status" => 1, + // "order_status_name" => "待发货"])); + } + + public function testPayType(){ + return $this->response(event('PayType', [])); + } + } \ No newline at end of file diff --git a/addon/fenxiao/config/event.php b/addon/fenxiao/config/event.php index aab5124f..41f91393 100644 --- a/addon/fenxiao/config/event.php +++ b/addon/fenxiao/config/event.php @@ -84,7 +84,10 @@ return [ //每日结算 'DaySettlement' => [ 'addon\fenxiao\event\DaySettlement', - ] + ], + 'AreaMonthlyReward'=>[ //区域代理月结 + 'addon\fenxiao\event\AutoAreaMonthlyReward', //区域代理月结 + ], ], 'subscribe' => [ diff --git a/addon/fenxiao/event/AutoAreaMonthlyReward.php b/addon/fenxiao/event/AutoAreaMonthlyReward.php new file mode 100644 index 00000000..70cfed17 --- /dev/null +++ b/addon/fenxiao/event/AutoAreaMonthlyReward.php @@ -0,0 +1,23 @@ +areaMonthlySettlement(); + return $res; + } +} \ No newline at end of file diff --git a/addon/fenxiao/model/Ageen.php b/addon/fenxiao/model/Ageen.php new file mode 100644 index 00000000..4238b03c --- /dev/null +++ b/addon/fenxiao/model/Ageen.php @@ -0,0 +1,125 @@ +add($data); + return $this->success($res); + } + + /** + * 编辑分销等级 + * @param $data + * @param array $condition + * @return array + */ + public function edit($data, $condition = []) + { + $data['update_time'] = time(); + $res = model('fenxiao_agent')->update($data, $condition); + return $this->success($res); + } + + /** + * 删除分销等级 + * @param array $condition + * @return array + */ + public function delete($id) + { + $fenxiao_model = new Fenxiao(); + $res = model('fenxiao_agent')->delete([['id', '=', $id]]); + return $this->success($res); + } + + /** + * 获取分销等级信息 + * @param array $condition + * @param string $field + * @return array + */ + public function getInfo($condition = [], $field = '*') + { + $res = model('fenxiao_agent')->getInfo($condition, $field); + return $this->success($res); + } + + /** + * @param array $condition + * @param string $field + * @return array + */ + public function getColumn($condition = [], $field = 'level_id') + { + $list = model('fenxiao_agent')->getColumn($condition, $field); + return $this->success($list); + } + + /** + * 获取分销商等级列表 + * @param array $condition + * @param string $field + * @param string $order + * @param string $limit + */ + public function getList($condition = [], $field = '*', $order = '', $limit = null) + { + $list = model('fenxiao_agent')->getList($condition, $field, $order, '', '', '', $limit); + return $this->success($list); + } + + /** + * 获取分销商等级分页列表 + * @param array $condition + * @param number $page + * @param string $page_size + * @param string $order + * @param string $field + */ + public function getPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*') + { + $condition[] = [ 'f.is_delete', '=', 0 ]; + $field = 'f.*,pf.fenxiao_name as parent_name,m.username,m.nickname,m.mobile as member_mobile,m.headimg,a.agent_level_id,a.agent_level_name,a.id'; + $alias = 'a'; + $join = [ + [ + 'fenxiao f', + 'a.fenxiao_id = f.fenxiao_id', + 'left' + ], + [ + 'fenxiao pf', + 'pf.fenxiao_id = f.parent', + 'left' + ], + [ + 'member m', + 'm.member_id = f.member_id', + 'left' + ], + ]; + $list = model('fenxiao_agent')->pageList($condition, $field, $order, $page, $page_size, $alias, $join); + // $list = model('fenxiao_agent')->pageList($condition, $field, $order, $page, $page_size); + return $this->success($list); + } +} \ No newline at end of file diff --git a/addon/fenxiao/model/AgeenLevel.php b/addon/fenxiao/model/AgeenLevel.php new file mode 100644 index 00000000..a3a50a78 --- /dev/null +++ b/addon/fenxiao/model/AgeenLevel.php @@ -0,0 +1,140 @@ +add($data); + return $this->success($res); + } + + /** + * 编辑分销等级 + * @param $data + * @param array $condition + * @return array + */ + public function editLevel($data, $condition = []) + { + $data['update_time'] = time(); + $res = model('fenxiao_agent_level')->update($data, $condition); + if ($res) { + if (isset($data['level_name']) && $data['level_name'] != '') { + $condition[0][0] = 'agent_level_id'; + model('fenxiao')->update(['agent_level_name' => $data['level_name']], $condition); + } + } + return $this->success($res); + } + + /** + * 删除分销等级 + * @param array $condition + * @return array + */ + public function deleteLevel($level_id, $site_id) + { + $fenxiao_model = new Fenxiao(); + $fenxiao_list = $fenxiao_model->getFenxiaoList([['agent_level_id', '=', $level_id]], 'fenxiao_id'); + if (empty($fenxiao_list['data'])) { + $res = model('fenxiao_agent_level')->delete([['level_id', '=', $level_id], ['site_id', '=', $site_id]]); + return $this->success($res); + } else { + return $this->error('', '该分销等级存在其他分销商,无法删除'); + } + } + + /** + * 获取分销等级信息 + * @param array $condition + * @param string $field + * @return array + */ + public function getLevelInfo($condition = [], $field = '*') + { + $res = model('fenxiao_agent_level')->getInfo($condition, $field); + return $this->success($res); + } + + /** + * @param array $condition + * @param string $field + * @return array + */ + public function getLevelColumn($condition = [], $field = 'level_id') + { + $list = model('fenxiao_agent_level')->getColumn($condition, $field); + return $this->success($list); + } + + /** + * 获取分销商等级列表 + * @param array $condition + * @param string $field + * @param string $order + * @param string $limit + */ + public function getLevelList($condition = [], $field = '*', $order = '', $limit = null) + { + $list = model('fenxiao_agent_level')->getList($condition, $field, $order, '', '', '', $limit); + return $this->success($list); + } + + /** + * 获取分销商等级分页列表 + * @param array $condition + * @param number $page + * @param string $page_size + * @param string $order + * @param string $field + */ + public function getLevelPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = '', $field = '*') + { + $list = model('fenxiao_agent_level')->pageList($condition, $field, $order, $page, $page_size); + return $this->success($list); + } + + /** + * 获取最低的分销商等级 + * @param array $condition + * @param string $field + * @return array + */ + public function getMinLevel($condition = [], $field = '*') + { + $info = model('fenxiao_agent_level')->getFirstData($condition, $field, 'level_num asc,one_rate asc'); + return $this->success($info); + } + + /** + * 某项排序的第一个 + * @param $condition + * @param $field + * @param $order + * @return array + */ + public function getLevelFirst($condition, $field, $order) + { + $first = model('fenxiao_agent_level')->getFirstData($condition, $field, $order); + return $this->success($first); + } +} \ No newline at end of file diff --git a/addon/fenxiao/model/FenxiaoOrder.php b/addon/fenxiao/model/FenxiaoOrder.php index bcb38347..443bb1a8 100644 --- a/addon/fenxiao/model/FenxiaoOrder.php +++ b/addon/fenxiao/model/FenxiaoOrder.php @@ -14,6 +14,7 @@ use app\model\BaseModel; use app\model\member\MemberAccount; use app\model\message\Message; use app\model\system\Stat; +use think\facade\Db; use think\facade\Log; /** @@ -34,16 +35,20 @@ class FenxiaoOrder extends BaseModel //上月 $begin_time = strtotime(date('Y-m-01 00:00:00', strtotime('-1 month'))); $end_time = strtotime(date("Y-m-d 23:59:59", strtotime(-date('d') . 'day'))); - $fenxiao = Db::name('fenxiao')->where([['is_area_agent', '=', 1],['status','=',1]])->column('fenxiao_id,site_id,member_id,fenxiao_name,agent_level_id,province_id,city_id,district_id,parent', 'fenxiao_id'); + $fenxiao = Db::name('fenxiao_agent')->alias('a')->join( + 'fenxiao f', + 'a.fenxiao_id = f.fenxiao_id', + 'left' + )->where([['f.status','=',1]])->column('f.fenxiao_id,f.site_id,member_id,fenxiao_name,agent_level_id,province_id,city_id,district_id,parent', 'f.fenxiao_id'); //获取分销基础配置 $config_model = new Config(); $fenxiao_basic_config = $config_model->getFenxiaoBasicsConfig(1); - $fenxiao_account = new FenxiaoAccount(); + $fenxiao_member_account = new MemberAccount(); foreach ($fenxiao as $fenxiao_id => $item) { $fenxiao_agent_level = Db::name('fenxiao_agent_level')->where('level_id', '=', $item['agent_level_id'])->field('type,flower_multiple,status')->find(); $where = [ - ['fo.create_time', 'BETWEEN', [$begin_time, $end_time]], - // ['fo.create_time', 'BETWEEN', [$beginThismonth, $endThismonth]], + // ['fo.create_time', 'BETWEEN', [$begin_time, $end_time]], + ['fo.create_time', 'BETWEEN', [$beginThismonth, $endThismonth]], ['o.'.$fenxiao_agent_level['type'].'_id', '=', $item[$fenxiao_agent_level['type'].'_id']] ]; $fenxia_area_order_info = Db::name('fenxiao_order') @@ -53,30 +58,31 @@ class FenxiaoOrder extends BaseModel ->field('sum(real_goods_money) as real_goods_money') ->find(); $money = $fenxia_area_order_info['real_goods_money'] * $fenxiao_agent_level['flower_multiple']/100; - $fruit_num = $money * $fenxiao_basic_config['data']['value']['fruit_flower_rate']; - $account_model = new FenxiaoAccount(); - //添加茶果 - $udata = [ - 'flower_num' => Db::raw('flower_num -' . $money), - 'fruit_num' => Db::raw('fruit_num +' . $fruit_num), - ]; - Db::name('fenxiao')->where([[ 'fenxiao_id', '=', $fenxiao_id ]])->update($udata); - $account_model->addAccountLog($fenxiao_id, $item['fenxiao_name'], 'fruit', $fruit_num, '', "代理奖励茶果-{$fruit_num}"); - $account_model->addAccountLog($fenxiao_id, $item['fenxiao_name'], 'flower', '-' . $money, '', "茶花转茶果{$money}"); + $fenxiao_member_account->addMemberAccount($item[ 'site_id' ], $item['member_id'], 'balance_money', $money, 'area', '区域代理结算', '区域代理结算'); - if($fenxiao_basic_config['data']['value']['agent_level_parent_rate'] > 0){ - $money = $money * $fenxiao_basic_config['data']['value']['agent_level_parent_rate'] / 100; - $fruit_num = $money * $fenxiao_basic_config['data']['value']['fruit_flower_rate']; - //添加茶果 - $udata = [ - 'flower_num' => Db::raw('flower_num -' . $money), - 'fruit_num' => Db::raw('fruit_num +'.$fruit_num) - ]; - $fenxiaoParent = Db::name('fenxiao')->where('fenxiao_id','=',$item['parent'])->alias('fenxiao_name')->find(); - Db::name('fenxiao')->where([['fenxiao_id','=',$item['parent']]])->update($udata); - $account_model->addAccountLog($item['parent'],$fenxiaoParent['fenxiao_name'],'fruit',$fruit_num,'',"推荐代理奖励茶果-{$fruit_num}"); - $account_model->addAccountLog($item['parent'],$fenxiaoParent['fenxiao_name'], 'flower', '-' . $money, '', "茶花转茶果{$money}"); - } + + // //添加茶果 + // $udata = [ + // 'flower_num' => Db::raw('flower_num -' . $money), + // 'fruit_num' => Db::raw('fruit_num +' . $fruit_num), + // ]; + // Db::name('fenxiao')->where([[ 'fenxiao_id', '=', $fenxiao_id ]])->update($udata); + // $account_model->addAccountLog($fenxiao_id, $item['fenxiao_name'], 'fruit', $fruit_num, '', "代理奖励茶果-{$fruit_num}"); + // $account_model->addAccountLog($fenxiao_id, $item['fenxiao_name'], 'flower', '-' . $money, '', "茶花转茶果{$money}"); + // + // if($fenxiao_basic_config['data']['value']['agent_level_parent_rate'] > 0){ + // $money = $money * $fenxiao_basic_config['data']['value']['agent_level_parent_rate'] / 100; + // $fruit_num = $money * $fenxiao_basic_config['data']['value']['fruit_flower_rate']; + // //添加茶果 + // $udata = [ + // 'flower_num' => Db::raw('flower_num -' . $money), + // 'fruit_num' => Db::raw('fruit_num +'.$fruit_num) + // ]; + // $fenxiaoParent = Db::name('fenxiao')->where('fenxiao_id','=',$item['parent'])->alias('fenxiao_name')->find(); + // Db::name('fenxiao')->where([['fenxiao_id','=',$item['parent']]])->update($udata); + // $account_model->addAccountLog($item['parent'],$fenxiaoParent['fenxiao_name'],'fruit',$fruit_num,'',"推荐代理奖励茶果-{$fruit_num}"); + // $account_model->addAccountLog($item['parent'],$fenxiaoParent['fenxiao_name'], 'flower', '-' . $money, '', "茶花转茶果{$money}"); + // } } return $this->success(); } @@ -260,7 +266,9 @@ class FenxiaoOrder extends BaseModel 'three_fenxiao_name' => empty($grand_parent_fenxiao_info) ? '' : $grand_parent_fenxiao_info[ 'fenxiao_name' ], 'create_time' => time() ]; - $this->orderGive($data); + if($order['promotion_type'] != 'pointexchange'){ + $this->orderGive($data); + } model("fenxiao_order")->add($data); } // 分销商检测升级 diff --git a/addon/fenxiao/shop/controller/Agentlevel.php b/addon/fenxiao/shop/controller/Agentlevel.php new file mode 100644 index 00000000..cc18a0e2 --- /dev/null +++ b/addon/fenxiao/shop/controller/Agentlevel.php @@ -0,0 +1,97 @@ +isAjax()) { + $page = input('page', 1); + $page_size = input('page_size', PAGE_LIST_ROWS); + $list = $model->getLevelPageList([['site_id', '=', $this->site_id]], $page, $page_size, '', '*'); + return $list; + } else { +// //获取系统配置 +// $config_model = new ConfigModel(); +// $basics = $config_model->getFenxiaoBasicsConfig($this->site_id); +// $this->assign("basics_info", $basics['data']['value']); + return $this->fetch('agentlevel/lists'); + } + } + + /** + * 添加等级 + */ + public function add() + { + $model = new AgeenLevel(); + if (request()->isAjax()) { + $data = [ + 'site_id' => $this->site_id, + 'level_name' => input('level_name', ''), + 'type' => input('type', ''), + 'remark' => input('remark', ''), + 'flower_multiple' => input('flower_multiple', ''), + 'flower_times' => input('flower_times', '') + ]; + $res = $model->addLevel($data); + return $res; + } else { + return $this->fetch('agentlevel/add'); + } + } + + /** + * 编辑等级 + */ + public function edit() + { + $model = new AgeenLevel(); + if (request()->isAjax()) { + $data = [ + 'level_name' => input('level_name', ''), + 'type' => input('type', ''), + 'remark' => input('remark', ''), + 'flower_multiple' => input('flower_multiple', 0), + 'flower_times' => input('flower_times', '') + ]; + $level_id = input('level_id', ''); + $res = $model->editLevel($data, [['level_id', '=', $level_id], ['site_id', '=', $this->site_id]]); + return $res; + } else { + $level_id = input('level_id', ''); + $info = $model->getLevelInfo([['level_id', '=', $level_id], ['site_id', '=', $this->site_id]]); + if (empty($info['data'])) return $this->error('未获取到等级数据', addon_url('fenxiao://shop/agentlevel/lists')); + $this->assign('info', $info['data']); + } + return $this->fetch('agentlevel/edit'); + } + + /** + * 删除分销等级 + */ + public function delete() + { + $model = new AgeenLevel(); + $level_id = input('level_id', ''); + $res = $model->deleteLevel($level_id, $this->site_id); + return $res; + } +} \ No newline at end of file diff --git a/addon/fenxiao/shop/controller/Area.php b/addon/fenxiao/shop/controller/Area.php new file mode 100644 index 00000000..190bfefe --- /dev/null +++ b/addon/fenxiao/shop/controller/Area.php @@ -0,0 +1,160 @@ +isAjax()) { + $condition = []; + $condition[] = ['f.site_id', '=', $this->site_id]; + // $condition[] = ['f.is_area_agent', '=', 1]; + $search_text_type=input('search_text_type'); + $search_text=input('search_text'); + switch ($search_text_type){ + case 'fenxiao_name' : + $condition[] = ['f.fenxiao_name', 'like', '%' . $search_text . '%']; + break; + case 'mobile' : + $condition[] = ['m.mobile', '=', $search_text]; + break; + case 'nickname' : + $condition[] = ['f.nickname', 'like', '%' . $search_text . '%']; + break; + case 'member_id' : + $condition[] = ['f.member_id', '=', $search_text]; + break; + } + $level_id = input('level_id', ''); + if ($level_id) { + $condition[] = ['f.level_id', '=', $level_id]; + } + $start_time = input('start_time', ''); + $end_time = input('end_time', ''); + if ($start_time && $end_time) { + $condition[] = ['f.create_time', 'between', [date_to_time($start_time), date_to_time($end_time)]]; + } elseif (!$start_time && $end_time) { + $condition[] = ['f.create_time', '<=', date_to_time($end_time)]; + + } elseif ($start_time && !$end_time) { + $condition[] = ['f.create_time', '>=', date_to_time($start_time)]; + } + $status = input('status', ''); + if (!empty($status)) { + $condition[] = ['f.status', '=', $status]; + } + $page = input('page', 1); + $page_size = input('page_size', PAGE_LIST_ROWS); + // $list = $model->getPageList($condition, $page, $page_size, 'f.create_time desc,a.create_time desc'); + $list = $model->getPageList($condition, $page, $page_size, ''); + return $list; + + } else { + $level_model = new AgeenLevel(); + $level_list = $level_model->getLevelList([['status', '=', 1], ['site_id', '=', $this->site_id]], 'level_id,level_name'); + $this->assign('level_list', $level_list['data']); + $config_model = new ConfigModel(); + $basics = $config_model->getFenxiaoBasicsConfig($this->site_id); + $this->assign("basics_info", $basics['data']['value']); + // $this->forthMenu(); + return $this->fetch('area/lists'); + } + } + /*** + * 添加代理商 + * @return array|mixed + */ + public function add(){ + //获取分销商列表 + $ageen_model = new Ageen(); + $fenxiao_model = new FenxiaoModel(); + //获取分销商等级 + $level_model = new AgeenLevel(); + if (request()->isAjax()) { + $fenxiao_id= input('fenxiao_id',0);//上级分销商ID + $province_id= input('province_id',0); + $city_id= input('city_id',0); + $district_id= input('district_id',0); + $level_id= input('level_id',0); + $fenxiao_data = [ + 'fenxiao_id' => $fenxiao_id, + 'agent_level_id' => input('level_id',''), + 'agent_level_name' => input('agent_level_name',''), + // 'is_area_agent' => 1, + 'province_id' => input('province_id',0), + 'city_id' => input('city_id',0), + 'district_id' => input('district_id',0) + ]; + $fenxiao=Db::name('fenxiao_agent') + ->whereOr('province_id','=',$province_id) + ->whereOr('city_id','=',$city_id) + ->whereOr('district_id','=',$district_id) + ->field('province_id,city_id,district_id,agent_level_id,fenxiao_id') + ->select(); + if($fenxiao){ + $area=array_column($fenxiao->toArray(),'agent_level_id'); + if(in_array($level_id,$area)){ + return error(-1,'当前区域已存在代理商'); + } + } + return $ageen_model->add($fenxiao_data); + } else { + $level_list = $level_model->getLevelList([['status', '=', 1], ['site_id', '=', $this->site_id]], 'level_id,level_name'); + $this->assign('level_list', $level_list['data']); + $condition[] = ['status','=','1']; + // $condition[] = ['is_area_agent','=','0']; + $fenxiao_list = $fenxiao_model->getFenxiaoList($condition, 'fenxiao_id,fenxiao_name'); + $this->assign('fenxiao_list', $fenxiao_list['data']); + //查询省级数据列表 + $address_model = new AddressModel(); + $list = $address_model->getAreaList([["pid", "=", 0], ["level", "=", 1]]); + $this->assign("province_list", $list["data"]); + return $this->fetch('area/add'); + } + } + public function remove(){ + //获取分销商列表 + $fenxiao_model = new Ageen(); + $id= input('id',0);//上级分销商ID + if(request()->isAjax()&&$id){ + return $fenxiao_model->delete($id); + } + } + /*** + * 查询分销商 + * @return array + */ + public function getfenxiaolist(){ + $page_index = input('page', 1); + $page_size = input('page_size', PAGE_LIST_ROWS); + $fenxiao_search = input("fenxiao_search", ''); + $condition = []; + $condition[] = [ 'mobile|fenxiao_name', 'like', '%'.$fenxiao_search.'%' ]; + $condition[] = [ 'status', '=', 1 ]; + // $condition[] = [ 'is_area_agent', '=', 0 ]; + $fenxiao_model = new FenxiaoModel(); + $list = $fenxiao_model->getFenxiaoPageLists($condition,$page_index,$page_size,'','fenxiao_id,fenxiao_name,account'); + return $list; + } +} \ No newline at end of file diff --git a/addon/fenxiao/shop/controller/Fenxiao.php b/addon/fenxiao/shop/controller/Fenxiao.php index d4719cff..7240f3c2 100644 --- a/addon/fenxiao/shop/controller/Fenxiao.php +++ b/addon/fenxiao/shop/controller/Fenxiao.php @@ -92,7 +92,7 @@ class Fenxiao extends BaseShop $commission_money = number_format($commission_money, 2); $this->assign('commission_money', $commission_money); - $this->forthMenu(); + // $this->forthMenu(); return $this->fetch('fenxiao/index'); } @@ -157,7 +157,7 @@ class Fenxiao extends BaseShop $basics = $config_model->getFenxiaoBasicsConfig($this->site_id); $this->assign("basics_info", $basics[ 'data' ][ 'value' ]); - $this->forthMenu(); + // $this->forthMenu(); return $this->fetch('fenxiao/lists'); } } @@ -252,7 +252,7 @@ class Fenxiao extends BaseShop $this->assign('level', $fenxiao_level[ 'data' ]); $this->assign('info', $info[ 'data' ]); - $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); + // $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); return $this->fetch('fenxiao/fenxiao_detail'); } @@ -304,7 +304,7 @@ class Fenxiao extends BaseShop } $this->assign('fenxiao_id', $fenxiao_id); - $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); + // $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); return $this->fetch('fenxiao/fenxiao_account'); } @@ -323,7 +323,7 @@ class Fenxiao extends BaseShop return $list; } else { $this->assign('fenxiao_id', $fenxiao_id); - $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); + // $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); $config_model = new ConfigModel(); $basics_config = $config_model->getFenxiaoBasicsConfig($this->site_id); @@ -376,7 +376,7 @@ class Fenxiao extends BaseShop } else { //订单状态 $this->assign('fenxiao_id', $fenxiao_id); - $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); + // $this->forthMenu([ 'fenxiao_id' => $fenxiao_id ]); return $this->fetch('fenxiao/order_lists', [], $this->replace); } } @@ -484,7 +484,7 @@ class Fenxiao extends BaseShop $level_list = $level_model->getLevelList([ [ 'status', '=', 1 ] ], 'level_id,level_name'); $this->assign('level_list', $level_list[ 'data' ]); - $this->forthMenu(); + // $this->forthMenu(); return $this->fetch('fenxiao/apply'); } } @@ -682,4 +682,19 @@ class Fenxiao extends BaseShop return $res; } } + + /** + * 购房券 + */ + public function adjustHousePurchase() + { + $fenxiao_id = input('fenxiao_id', 0); + $adjust_num = input('adjust_num', 0); + // $remark = input('remark', '商家调整'); + $remark = '后台核销'; + // $this->addLog("会员消费券调整id:" . $member_id . "金额" . $adjust_num); + $fenxiao = model('fenxiao')->getInfo(['fenxiao_id' => $fenxiao_id, 'site_id' => $this->site_id], 'fenxiao_id,fenxiao_name,parent,grand_parent'); + $fenxiao_account_model = new FenxiaoAccount(); + return $fenxiao_account_model->addAccount($fenxiao['fenxiao_id'], $fenxiao['fenxiao_name'], 'house_purchase', -$adjust_num, $fenxiao['fenxiao_id'], 'house_purchase', $remark); + } } \ No newline at end of file diff --git a/addon/fenxiao/shop/controller/Goods.php b/addon/fenxiao/shop/controller/Goods.php index 3fa7e08f..e3fd4051 100644 --- a/addon/fenxiao/shop/controller/Goods.php +++ b/addon/fenxiao/shop/controller/Goods.php @@ -68,7 +68,7 @@ class Goods extends BaseShop $list = $model->getGoodsPageList($condition, $page_index, $page_size); return $list; } else { - $this->forthMenu(); + // $this->forthMenu(); return $this->fetch('goods/lists'); } } diff --git a/addon/fenxiao/shop/controller/Order.php b/addon/fenxiao/shop/controller/Order.php index 7194696a..a3682913 100644 --- a/addon/fenxiao/shop/controller/Order.php +++ b/addon/fenxiao/shop/controller/Order.php @@ -67,7 +67,7 @@ class Order extends BaseShop return $list; } else { - $this->forthMenu(); + // $this->forthMenu(); //订单状态 return $this->fetch('order/lists', [], $this->replace); } diff --git a/addon/fenxiao/shop/view/agentlevel/add.html b/addon/fenxiao/shop/view/agentlevel/add.html new file mode 100644 index 00000000..4ea91dfd --- /dev/null +++ b/addon/fenxiao/shop/view/agentlevel/add.html @@ -0,0 +1,135 @@ +{extend name="app/shop/view/base.html"/} +{block name="resources"} + +{/block} +{block name="main"} +
+
+
+ 基础信息 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + + + + + +
+ +
+ + + +
+
+
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+{/block} +{block name="script"} + +{/block} \ No newline at end of file diff --git a/addon/fenxiao/shop/view/agentlevel/edit.html b/addon/fenxiao/shop/view/agentlevel/edit.html new file mode 100644 index 00000000..5abb2f48 --- /dev/null +++ b/addon/fenxiao/shop/view/agentlevel/edit.html @@ -0,0 +1,113 @@ +{extend name="app/shop/view/base.html"/} +{block name="resources"} + +{/block} +{block name="main"} +
+
+
+ 基础信息 +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ + + + + + + + +
+ +
+ + + +
+
+ +
+ +
+ +
+
+
+
+
+
+
+ + +
+
+
+
+{/block} +{block name="script"} + +{/block} \ No newline at end of file diff --git a/addon/fenxiao/shop/view/agentlevel/lists.html b/addon/fenxiao/shop/view/agentlevel/lists.html new file mode 100644 index 00000000..b82a05f9 --- /dev/null +++ b/addon/fenxiao/shop/view/agentlevel/lists.html @@ -0,0 +1,212 @@ +{extend name="app/shop/view/base.html"/} +{block name="resources"} +{/block} +{block name="main"} +
+
+

操作提示

+ +
+
+ +
+ +
+ +
+ + + + + + +{/block} + +{block name="script"} + +{/block} \ No newline at end of file diff --git a/addon/fenxiao/shop/view/area/add.html b/addon/fenxiao/shop/view/area/add.html new file mode 100644 index 00000000..a1dfdcac --- /dev/null +++ b/addon/fenxiao/shop/view/area/add.html @@ -0,0 +1,207 @@ +{extend name="app/shop/view/base.html"/} +{block name="resources"} + +{/block} +{block name="main"} +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+ + +
+
+{/block} +{block name="script"} + + + +{/block} diff --git a/addon/fenxiao/shop/view/area/lists.html b/addon/fenxiao/shop/view/area/lists.html new file mode 100644 index 00000000..1a391750 --- /dev/null +++ b/addon/fenxiao/shop/view/area/lists.html @@ -0,0 +1,285 @@ +{extend name="app/shop/view/base.html"/} +{block name="resources"} + +{/block} +{block name="main"} +
+
+

操作提示

+ +
+
+
+ +
+
+
+

+
+
+
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ + +
+
-
+
+ + +
+
+
+ +
+ + +
+
+
+
+ + +
+ + + + + + + + + + + + + +{/block} + +{block name="script"} + +{/block} \ No newline at end of file diff --git a/addon/fenxiao/shop/view/fenxiao/lists.html b/addon/fenxiao/shop/view/fenxiao/lists.html index 0804094e..3e600df3 100644 --- a/addon/fenxiao/shop/view/fenxiao/lists.html +++ b/addon/fenxiao/shop/view/fenxiao/lists.html @@ -91,6 +91,38 @@
+ + + {/block} \ No newline at end of file diff --git a/addon/pointexchange/shop/view/exchange/add.html b/addon/pointexchange/shop/view/exchange/add.html index faa1a08f..a4246920 100644 --- a/addon/pointexchange/shop/view/exchange/add.html +++ b/addon/pointexchange/shop/view/exchange/add.html @@ -286,7 +286,7 @@ {block name="script"} @@ -911,7 +911,7 @@ width: '14%', templet: '#exchangeLimit' }, { - title: '所需积分', + title: '所需兑换券', unresize: 'false', width: '12%', templet: '#exchangePoint' @@ -959,7 +959,7 @@ name: '兑换次数', value: 'limit_num' },{ - name: '所需积分', + name: '所需兑换券', value: 'point' },{ name: '所需金额', diff --git a/addon/pointexchange/shop/view/exchange/edit.html b/addon/pointexchange/shop/view/exchange/edit.html index 5a658438..8ac4fce0 100644 --- a/addon/pointexchange/shop/view/exchange/edit.html +++ b/addon/pointexchange/shop/view/exchange/edit.html @@ -342,7 +342,7 @@ {block name="script"} @@ -712,7 +712,7 @@ width: '14%', templet: '#exchangeLimit' }, { - title: '所需积分', + title: '所需兑换券', unresize: 'false', width: '12%', templet: '#exchangePoint' @@ -755,7 +755,7 @@ name: '兑换次数', value: 'limit_num' },{ - name: '所需积分', + name: '所需兑换券', value: 'point' },{ name: '所需金额', diff --git a/addon/weapp/config/menu_shop.php b/addon/weapp/config/menu_shop.php index 9e52d946..a3f58703 100644 --- a/addon/weapp/config/menu_shop.php +++ b/addon/weapp/config/menu_shop.php @@ -11,7 +11,7 @@ return [ 'picture_select' => '', 'picture' => 'addon/weapp/shop/view/public/img/menu_icon/wechat_app_new.png', 'picture_selected' => 'addon/weapp/shop/view/public/img/menu_icon/wechat_app_select.png', - 'is_show' => 0, + 'is_show' => 1, 'sort' => 4, 'child_list' => [ [ diff --git a/addon/wechat/config/menu_shop.php b/addon/wechat/config/menu_shop.php index c5bec9b3..ee5295d3 100644 --- a/addon/wechat/config/menu_shop.php +++ b/addon/wechat/config/menu_shop.php @@ -16,7 +16,7 @@ return [ 'picture_select' => '', 'picture' => 'addon/wechat/shop/view/public/img/menu_icon/wechat_icon_new.png', 'picture_selected' => 'addon/wechat/shop/view/public/img/menu_icon/wechat_icon_select.png', - 'is_show' => 0, + 'is_show' => 1, 'sort' => 3, 'child_list' => [ [ diff --git a/addon/wechatpay/config/menu_shop.php b/addon/wechatpay/config/menu_shop.php index 1d593bd1..131ab08a 100644 --- a/addon/wechatpay/config/menu_shop.php +++ b/addon/wechatpay/config/menu_shop.php @@ -8,7 +8,7 @@ return [ 'title' => '微信支付编辑', 'url' => 'wechatpay://shop/pay/config', 'parent' => 'CONFIG_PAY', - 'is_show' => 0, + 'is_show' => 1, 'is_control' => 1, 'is_icon' => 0, 'picture' => '', diff --git a/app/api/controller/Addon.php b/app/api/controller/Addon.php index 3b896f14..2742a079 100644 --- a/app/api/controller/Addon.php +++ b/app/api/controller/Addon.php @@ -42,7 +42,7 @@ class Addon extends BaseApi $res[ 'membersignin' ] = in_array("membersignin", $addons) ? 1 : 0; // 会员签到 $res[ 'memberrecharge' ] = in_array("memberrecharge", $addons) ? 1 : 0; // 会员充值 $res[ 'memberwithdraw' ] = in_array("memberwithdraw", $addons) ? 1 : 0; // 会员提现 - $res[ 'pointexchange' ] = in_array("pointexchange", $addons) ? 1 : 0; // 积分兑换 + $res[ 'pointexchange' ] = in_array("pointexchange", $addons) ? 1 : 1; // 积分兑换 $res[ 'manjian' ] = in_array("manjian", $addons) ? 1 : 0; //满减 $res[ 'memberconsume' ] = in_array("memberconsume", $addons) ? 1 : 0; //会员消费 $res[ 'memberregister' ] = in_array("memberregister", $addons) ? 1 : 0; //会员注册 @@ -61,7 +61,7 @@ class Addon extends BaseApi $res[ 'live' ] = in_array("live", $addons) ? 1 : 0; // 小程序直播 $res[ 'cards' ] = in_array("cards", $addons) ? 1 : 0; // 刮刮乐 $res[ 'egg' ] = in_array("egg", $addons) ? 1 : 0; // 砸金蛋 - $res[ 'turntable' ] = in_array("turntable", $addons) ? 1 : 0; // 幸运抽奖 + $res[ 'turntable' ] = in_array("turntable", $addons) ? 1 : 1; // 幸运抽奖 $res[ 'memberrecommend' ] = in_array("memberrecommend", $addons) ? 1 : 0; // 推荐奖励 $res[ 'supermember' ] = in_array("supermember", $addons) ? 1 : 0; // 超级会员卡 $res[ 'giftcard' ] = in_array("giftcard", $addons) ? 1 : 0; // 兑换卡 diff --git a/app/model/member/Member.php b/app/model/member/Member.php index bfe1a403..4e2bf695 100644 --- a/app/model/member/Member.php +++ b/app/model/member/Member.php @@ -81,6 +81,8 @@ class Member extends BaseModel if ($res === false) { return $this->error('', 'RESULT_ERROR'); } + $rcode=createShareCode($res); + model("member")->update(['rcode' => $rcode],[['member_id', '=', $res]]); //添加统计 $stat = new Stat(); $stat->switchStat([ 'type' => 'add_member', 'data' => [ 'member_count' => 1, 'site_id' => $data[ 'site_id' ] ] ]); diff --git a/app/model/member/MemberAccount.php b/app/model/member/MemberAccount.php index 772ccfe9..42266daa 100644 --- a/app/model/member/MemberAccount.php +++ b/app/model/member/MemberAccount.php @@ -87,6 +87,8 @@ class MemberAccount extends BaseModel $from_type[ 'point' ][ 'refund' ] = [ 'type_name' => '退还', 'type_url' => '' ]; $from_type[ 'point' ][ 'pointexchangerefund' ] = [ 'type_name' => '积分兑换退还', 'type_url' => '' ]; + $from_type[ 'point' ][ 'pointexchange' ] = [ 'type_name' => '兑换券兑换商品', 'type_url' => '' ]; + $from_type[ 'balance' ][ 'presale_deposit_refund' ] = [ 'type_name' => '预售定金退还', 'type_url' => '' ]; $from_type[ 'balance' ][ 'presale_refund' ] = [ 'type_name' => '预售订单退还', 'type_url' => '' ]; @@ -119,6 +121,7 @@ class MemberAccount extends BaseModel $from_type[ 'point' ][ 'day_settlement' ] = [ 'type_name' => '每日转换', 'type_url' => '' ]; $from_type[ 'balance_money' ][ 'day_settlement' ] = [ 'type_name' => '每日转换', 'type_url' => '' ]; + $from_type[ 'balance_money' ][ 'area' ] = [ 'type_name' => '区域代理结算', 'type_url' => '' ]; $this->from_type = $from_type; } diff --git a/app/model/member/Register.php b/app/model/member/Register.php index 14e8920b..5b589727 100644 --- a/app/model/member/Register.php +++ b/app/model/member/Register.php @@ -263,6 +263,9 @@ class Register extends BaseModel ]; $res = model("member")->add($data_reg); if ($res) { + + $rcode=createShareCode($res); + model("member")->update(['rcode' => $rcode],[['member_id', '=', $res]]); if (!empty($member_level_info)) { $member_account_model = new MemberAccount(); //赠送红包 diff --git a/app/model/order/OrderCommon.php b/app/model/order/OrderCommon.php index 944078e3..683537aa 100644 --- a/app/model/order/OrderCommon.php +++ b/app/model/order/OrderCommon.php @@ -1542,6 +1542,7 @@ class OrderCommon extends BaseModel */ public function addOrderLog($data) { + unset($data['id']); $data['action_time'] = time();//操作时间 $res = model('order_log')->add($data); return $this->success($res); diff --git a/config/menu_shop.php b/config/menu_shop.php index f4182a99..047c69ea 100644 --- a/config/menu_shop.php +++ b/config/menu_shop.php @@ -2003,7 +2003,7 @@ return [ 'url' => 'fenxiao://shop/level/lists', 'is_show' => 0, 'is_control' => 1, - 'sort' => 6, + 'sort' => 99, 'child_list' => [ [ 'name' => 'PROMOTION_FENXIAO_LEVEL_ADD', @@ -2071,6 +2071,86 @@ return [ ] ] ], + [ + 'name' => 'PROMOTION_FENXIAO_AGENT', + 'title' => '区域代理', + 'url' => 'fenxiao://shop/area/lists', + 'parent' => 'PROMOTION_ROOT', + 'picture' => 'addon/fenxiao/shop/view/public/img/distribution_new.png', + 'picture_selected' => 'addon/fenxiao/shop/view/public/img/distribution_select.png', + 'is_show' => 1, + 'sort' => 6, + 'child_list'=>[ + [ + 'name' => 'PROMOTION_FENXIAO_AREA_ROOT', + 'title' => '区域代理', + 'url' => 'fenxiao://shop/area/lists', + 'is_show' => 1, + 'is_control' => 1, + 'sort' => 1, + 'child_list' => [ + [ + 'name' => 'PROMOTION_FENXIAO_AREA_ADD', + 'title' => '添加区域商', + 'url' => 'fenxiao://shop/area/add', + 'is_show' => 1, + ], + [ + 'name' => 'PROMOTION_FENXIAO_AREA_DETAIL', + 'title' => '代理商信息', + 'url' => 'fenxiao://shop/area/detail', + 'is_show' => 1, + ], + [ + 'name' => 'PROMOTION_FENXIAO_AREA_DEL', + 'title' => '删除', + 'url' => 'fenxiao://shop/area/del', + 'is_show' => 1, + ] + ] + ], + [ + 'name' => 'PROMOTION_FENXIAO_AGENT_LEVEL', + 'title' => '区域等级', + 'url' => 'fenxiao://shop/agentlevel/lists', + 'is_show' => 1, + 'is_control' => 1, + 'sort' => 2, + 'child_list' => [ + [ + 'name' => 'PROMOTION_FENXIAO_AGENT_LEVEL_LISTS', + 'title' => '等级列表', + 'url' => 'fenxiao://shop/agentlevel/lists', + 'is_show' => 0, + ], + [ + 'name' => 'PROMOTION_FENXIAO_AGENT_LEVEL_ADD', + 'title' => '添加等级', + 'url' => 'fenxiao://shop/agentlevel/add', + 'is_show' => 0, + ], + [ + 'name' => 'PROMOTION_FENXIAO_AGENT_LEVEL_EDIT', + 'title' => '编辑等级', + 'url' => 'fenxiao://shop/agentlevel/edit', + 'is_show' => 0, + ], + [ + 'name' => 'PROMOTION_FENXIAO_AGENT_LEVEL_STATUS', + 'title' => '等级状态设置', + 'url' => 'fenxiao://shop/agentlevel/status', + 'is_show' => 0, + ], + [ + 'name' => 'PROMOTION_FENXIAO_AGENT_LEVEL_DELETE', + 'title' => '删除等级', + 'url' => 'fenxiao://shop/agentlevel/delete', + 'is_show' => 0, + ] + ] + ] + ] + ], // [ // 'name' => 'PROMOTION_FENXIAO_MARKET', // 'title' => '分销市场',