🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
try_files $uri $uri/ /index.php?$args; ALTER TABLE marketing_hu_year_paintings_prize ADD member_coupons_id int(11) NOT Null comment '优惠券编码' AFTER coupon_rule_id; ALTER TABLE ldb_tencent_advertising ADD wechat_qrcode_name varchar(100) DEFAULT NULL comment '微信二维码名称' AFTER wechat_qrcode_id; ALTER TABLE ldb_tencent_advertising ADD limit_date date DEFAULT NULL comment '限制日期' AFTER show_time; MySQL热备份 php artisan make:migration create_categories_table --create=categories php artisan make:migration create_posts_table --create=posts php artisan make:migration add_posts_table --add=posts 1.获取token 2.刷新token 3.上报数据 问题: 1.确认查看数据的位置, 2.落地页目前是不是只会查看固定的数据源 3.自动化获取token 1110 111 111 111 111 设计图 参数的判断和 “actions”: [ { “url”: “<URL>“, “action_time”: <action_timestamp>, “action_type”: “RESERVATION”, “trace”: { “click_id”: “<CLICK_ID>“ } } ] { "user_action_set_id": 1110250758, "actions": [{ "external_action_id":1110250758, "action_time":1492998081, "user_id":{ "hash_imei":"698d51a19d8a121ce581499d7b701668" }, "action_type":"CUSTOM", "custom_action":"my_type", "action_param":{ "value":28, "quantity":5, "brand_name":"my_brand", "int_example":123, "int_array_example":[ 123, 234 ], "double_example":123.45, "double_array_example":[ 123.45, 234.56 ], "bool_example":true, "bool_array_example":[ true, false ], "string_example":"123", "string_array_example":[ "123", "234", "abc" ] }, "product_inform":{ "content_type":"EC", "category_path":[ "\u5bb6\u7528\u7535\u5668\/\u53a8\u623f\u5c0f\u7535\/\u8c46\u6d46\u673a", "\u672c\u5730\u751f\u6d3b\u65c5\u6e38\u51fa\u884c\/\u65c5\u6e38\u51fa\u884c\/\u673a\u7968\u706b\u8f66\u7968" ] }, "channel":"CHANNEL_NATURAL" }] } "account_id":4012484, { "user_action_set_id":1110250758, "actions":[ { "action_type":"RESERVATION", "action_time":1492998081, "url":"https://malltest.osa.com/mobile/index", "trace":{ "click_id":"11" } } ] } 看有没有二维码, 如果有,读取现有二维码 如果没有,进入算法 openid 目前的逻辑: 用户访问落地页,显示已经分配的二维码 如果是新用户,之前没有分配二维码,那么进入轮循,显示其他二维码 用户扫描后触发行为,调用后端腾讯广告的接口,用户获得分配的二维码 疑问: 如果用户不扫描,不触发调用腾讯广告的接口,如果他重复访问落地页3次,那么这3次显示的是最少分配次数的二维码,是不是需要另外记录再写一套逻辑,还是随机 落地页的平均轮循规则: 扫描二维码->触发行为->腾讯广告接口->内部记录分配次数 分配次数少的二维码排队,最后实现接近一样的分配次数 1.落地页 ->OK 2.用户端展示页面,轮循 ->OK,需要修改(记录用户对应的二维码,删除的二维码再后补) 3.记录配置量 ->OK 4.腾讯广告 - 进行中 5.多选操作:停用+启动+设置最大分配量+删除 6.导入导出 7.测试整个流程 轮询继续,增加操作加入条件判断,两次调用 保持轮询 后端: 修改分配算法:记录用户对应的二维码,删除的二维码再后补 导入导出 腾讯广告接口(自动生成access_token) 前端需要配合: 调用分配算法功能,添加openid参数 导入导出-调用接口 后端剩下: (半天):2.用户端展示页面,轮循 ->OK,需要修改(记录用户对应的二维码,删除的二维码再后补) (1-2天):4.腾讯广告 - 进行中 (半天):5.多选操作:停用+启动+删除+设置最大分配量 (半天):6.导入导出 (半天):7.测试整个流程 预计3-4天 目前我接通了这个接口,但是不知道是数据延时,还是其他问题,返回数据很少 1.应该是创建接口出现一些问题, 完成自动化读取token 主要确定user_action_set_id和action_type,前端是否需要传 用户行为源id和 { "account_id": "4012484", "type": "WEB", "name": "webuser_action_set", "description": "", "usages": [] } { "type": "WEB", "name": "webuser_action_set" } {"start_date":"2022-01-01","end_date":"2022-03-05"} [{"start_date":"2022-01-01","end_date":"2022-03-05"}] curl https://api.e.qq.com/v1.3/user_action_sets/add?access_token=605001b6ec5af7e1adaba343c5940c52&timestamp=1646360030&nonce=f7e1adaba343c5940c5%26times1111 curl https://api.e.qq.com/v1.3/user_action_sets/add?access_token=605001b6ec5af7e1adaba343c5940c52&timestamp=1646360030&nonce=f7e1adaba343c5940c5%26times1111 \ -H Content-Type: application/json \ -d '{ "account_id": "4012484", "type": "WEB", "name": "webuser_action_set", "description": "", "usages": [] }' 平均分配算法: 1.优先给从没有获得机会的 2.之后从排队最久的开始 记录数据: 总累计分配数量 当天累计分配数量 当天最大分配量 当天规则下的分配数量 做前面两个,还是三个都做: 1.创建用户行为数据源 2.获取用户行为数据源 3.获取用户行为数据源报表 - 未知 https://developers.e.qq.com/oauth/authorize?client_id=1112006251&redirect_uri= https://tfeimall.com/mobile/index https://developers.e.qq.com/oauth/authorize?client_id=1112006251&redirect_uri=https://tfeimall.com/mobile/index&state=&scope=&account_type=ACCOUNT_TYPE_WECHAT client_id=1112006251 微信广告 代理商 账户ID: 4012484 SpID:spidb9f0141753 上饶市巨网科技有限公司 调转获取authorization_code https://developers.e.qq.com/oauth/authorize?client_id=1112006251&redirect_uri=https%3A%2F%2Ftfeimall.com%2Fmobile%2Findex&state=&scope=&account_type=ACCOUNT_TYPE_WECHAT https://tfeimall.com/mobile/index?authorization_code=26aa5c3158202fbc2c697b87edae1280&state=#/ 26aa5c3158202fbc2c697b87edae1280 目前30天有效,可能依据需求做一个页面用来保存token,以及延长更新时间 https://api.e.qq.com/oauth/token?client_id=1112006251&client_secret=&grant_type=&authorization_code= refresh_token= redirect_uri= 1110834175 - 1106245328 6f9ad785 https://api.e.qq.com/v1.3/user_action_sets/add?access_token=605001b6ec5af7e1adaba343c5940c52&timestamp=1646298150&nonce=<NONCE> https://api.e.qq.com/v1.1/campaigns/get?access_token=<ACCESS_TOKEN>&timestamp=<TIMESTAMP>&nonce=<NONCE> public static function clearWechatUser($groups) { $wechatUser = Advertising::whereIn('group_id', $groups); $wechatUser = $wechatUser->orderBy('limit_date', 'DESC')->first(); if(mb_substr($wechatUser['show_time'], 0, 10) == date("Y-m-d") ) { $update = Advertising::whereIn('group_id', $groups) ->update([ 'today_assigned_quantity' => 0, 'limit_date' => '1800-01-01', ]); } else { $update = Advertising::whereIn('group_id', $groups) ->update([ 'today_assigned_quantity' => 0, 'today_passing_quantity' => 0, 'limit_date' => '1800-01-01', ]); } return $update; } /** * 清空当天之前的限制记录 * @param Request $request * @return mixed */ public static function clearLimitWechatUser($groups) { $wechatUser = Advertising::whereIn('group_id', $groups); $wechatUser = $wechatUser->orderBy('limit_date', 'DESC')->first(); if($wechatUser['limit_date'] < date("Y-m-d",strtotime("+1 day",strtotime(date("Y-m-d")))) ) { $update = self::clearWechatUser($groups); } return $update; } 1-1-1-1 2-2-2-2 3-3-6-3 4-4-7-4 5-5-5 6-3-6 7-4-7 8-5-8 9-6-9 10-7-10 11-4 算法: 优先处理0次机会,从id最小开始 任何人都有一次 创建模板接口可以选择关闭海报,最新编辑的模板分组保存接口,会立即启用 [{"qr_code_width":30,"qr_code_height":10,"qr_code_x_axis":100,"qr_code_y_axis":300}] "select * from `ldb_tencent_advertising_template_group_relationship` where `template_id` = ? order by `created_at` desc" 加入if($page_type = 3) php artisan queue:work php artisan queue:restart 列表,详情,创建 qr_code_width qr_code_height qr_code_x_axis qr_code_y_axis cnpm install -g @vue/cli vue create vue3 {"id":1,"name":"你好"} { "username": "test1", "email": "113075416@qq.com", "code": "123456" } 图片id和name,array格式,例:[{"image_id":1,"image_name":"图片1"}] "select * from `ldb_tencent_advertising` where `group_id` = ? order by `cumulative_assigned_quantity` asc, `today_assigned_quantity` asc, `passing_quantity` asc, `today_maximum_assigned` asc" "select `ldb_tencent_advertising_group`.*, (select count(*) from `ldb_tencent_advertising` where `ldb_tencent_advertising_group`.`id` = `ldb_tencent_advertising`.`group_id`) as `advertisings_count` from `ldb_tencent_advertising_group`" "select `ldb_tencent_advertising_group`.*, (select count(*) from `ldb_tencent_advertising` where `ldb_tencent_advertising_group`.`id` = `ldb_tencent_advertising`.`group_id`) as `advertising_group_count` from `ldb_tencent_advertising_group`" 展示+搜索+排序+分页 { "provider": "SF", "logi_name": "顺丰", "tracking_number": "SF1360441916607", "customer_name": "3328" } { "provider": "YTO", "logi_name": "圆通", "tracking_number": "YT6277724382170" } // if (isset($input['wecaht_name'])) { // // $list->orWhere('phone', $input['phone']); // } // if (isset($input['wecaht_name'])) { // $list->orWhere('phone', $input['phone']); // } $provider = array('SF'); if (in_array($input['provider'], $provider)) { $input['tracking_type'] = 1; $express = new Express($input); return $this->success($express->query()); } 'CustomerName' => 'nullable', update, 停用,启用,设置最大分配量 删除, 1.腾讯广告,打广告,获得数据 2.微信地址,获取微信地址数据,读取商城数据库 快递鸟信息对接 - 2022年2月10号 微信地址获取 - 2022年2月12号 微店区域信息 - 2022年2月17号 腾讯广告 - 未定 数据脱敏 - 未定 固定字符串 VS 替换固定sql函数 STEP1:账户配置授权:https://developers.e.qq.com/oauth/authorize?client_id=123456&redirect_uri=https://www.example.com STEP2:创建数据源:user_action_sets_add STEP3:上报用户行为数据:user_actions_add STEP4:查看数据报表:user_action_set_reports/get 后端代码风格有点不一致,提交代码之前统一使用编辑器调整代码格式方法调整之后再提交,快捷键ctrl+alt+l 1-0.2 style Route::resource('admin/regionalManagement', 'AreaController'); // 获取所有微店地区列表 Route::get('admin/regional/allArea', 'AreaController@allArea'); 1万个应用 https://malltest.osa.com/api/admin/Store?page=1&limit=10&type=1&timestamp=1644919192&appkey=1224283400&sign=9AEDF4B1DA4B185314B071A3CBF7C0C5&areaId=1 批量查接口API 依据具体API,获取对应的数据 'areaId' => 'integer', 广东省id1-深圳id2-罗湖id3, id,check有没有children,有就获取所有children,没有就获取当前级 最后whereIn('area_three_level_id', ['array']) 选择,提交id post category tag commen https://developers.e.qq.com/oauth/authorize?client_id=123456&redirect_uri=https://www.example.com /** * @param \Illuminate\Http\Request $request * 1推1,5打卡1,5认证1 * @return mixed * 依据微信数据查询用户地址信息id */ public function getRegionIdsByWechatData(Request $request) { $input = $request->only('first_region', 'second_region', 'third_region'); $validationCondition = [ 'first_region' => 'required|string', 'second_region' => 'nullable|string', 'third_region' => 'nullable|string', ]; $validator = Validator::make($input, $validationCondition); if ($validator->fails()) { return $this->success([], 'error', 200, '数据格式错误'); } $regionKey = [ 0 => 'first_region_id', 1 => 'second_region_id', 2 => 'third_region_id', ]; for ($k=0; $k<count($regionKey); $k++) { $result[$regionKey[$k]] = ''; } // 查询物流地区id $regions = Region::where('region_name', 'like', '%'.$input['first_region'].'%') ->orWhere('region_name', 'like', '%'.$input['second_region'].'%') ->orWhere('region_name', 'like', '%'.$input['third_region'].'%') ->get(); $i = 0; $tem[0] = 0; for ($y=0; $y<count($regionKey); $y++) { foreach($regions as $key => $region) { $regionArray = explode(',', $region['region_path']); $regionArray = array_filter($regionArray); $regionArray= array_merge($regionArray); // p_region_id有对应父级,同时region_path字段有对应数量的元素 if($region['p_region_id'] == $tem[$i] && count(array_filter($regionArray)) == $i+1) { $result[$regionKey[$i]] = $regionArray[$i]; $temId = $regionArray[$i]; $i++; $tem[$i] = $temId; unset($regions[$key]); } } } if($regionKey[0] == '') { return $this->success($result, 'error', 200, '暂无数据'); } return $this->success($result); } "links": { "first": "http://n.mall-test.com/api/orders/filter?page=1", "last": "http://n.mall-test.com/api/orders/filter?page=35", "prev": "http://n.mall-test.com/api/orders/filter?page=1", "next": "http://n.mall-test.com/api/orders/filter?page=3" }, "links": { "first": "http://localhost/api/orders/filter?page=1", "last": "http://localhost/api/orders/filter?page=39", "prev": "http://localhost/api/orders/filter?page=1", "next": "http://localhost/api/orders/filter?page=3" }, /** * @param Request $request * @return mixed * 依据微信数据查询用户地址信息id */ public function getRegionIdsByWechatData(Request $request) { $input = $request->only('first_region', 'second_region', 'third_region'); $validationCondition = [ 'first_region' => 'required|string', 'second_region' => 'nullable|string', 'third_region' => 'nullable|string' ]; $validator = Validator::make($input, $validationCondition); if ($validator->fails()) { return $this->success(false, 'error', 200, '数据格式错误'); } $regions = Region::where(function ($query) use ($input) { $query->where('region_name', 'like', '%' . $input['first_region'] . '%') ->where('region_grade', 1); }) ->orWhere(function ($query) use ($input) { $query->where('region_name', 'like', '%' . $input['second_region'] . '%') ->where('region_grade', 2); }) ->orWhere(function ($query) use ($input) { $query->where('region_name', 'like', '%' . $input['third_region'] . '%') ->where('region_grade', 3); }) ->get(['id', 'region_name', 'p_region_id', 'region_path', 'region_grade']); // $regions[12] = $regions[2]; // unset($regions[0]); $regions[12] = array( "id" => 12, "region_name" => "重庆市111", "p_region_id" => "86", "region_path" => ",86,179511,", "region_grade" => "2", ); dd($regions->toArray()); $firstRegion = $regions->where('region_grade', 1); if ($firstRegion->count() != 1) { return $this->success(false, 'error', 200, '地址导入失败'); } $secondRegion = $regions->where('region_grade', 2)->where('p_region_id', $firstRegion->first()->id); $thirdRegion = $regions->where('region_grade', 3)->where('p_region_id', $secondRegion->first()->id); // dd($secondRegion->toArray()); if ($firstRegion->isEmpty() || $secondRegion->isEmpty() || $thirdRegion->isEmpty()) { return $this->success(false, 'error', 200, '微信地址导入失败'); } return $this->success(array( 'first_region_id' => $firstRegion->first()->id, 'second_region_id' => $secondRegion->first()->id, 'third_region_id' => $thirdRegion->first()->id )); } ^ "select * from `ldb_region_name` where `region_name` like ? and `region_grade` = ? or `region_name` like ? and `region_grade` = ? or `region_name` like ? and `region_grade` = ?" fisrt_region_id: 86 region_path second_region_id: 1795 third_region_id: 85 https://malltest.osa.com/api/region?timestamp=1644386452&appkey=1224283400&sign=CC30CB7051150F16565846B225DC496E https://malltest.osa.com/api/region/665?timestamp=1644386514&appkey=1224283400&sign=CC30CB7051150F16565846B225DC496E https://malltest.osa.com/api/region/206?timestamp=1644386551&appkey=1224283400&sign=CC30CB7051150F16565846B225DC496E SELECT * FROM ldb_regions WHERE region_name LIKE '%广东%'; ,3756, SELECT * FROM ldb_regions WHERE region_name LIKE '%深圳%'; ,3756,1207, SELECT * FROM ldb_regions WHERE region_name LIKE '%福田%'; ldb_delivery ldb_dlycorps http://tf.mall.com/mobile/index#/orderDetailView?order_no=220106194325295 https://malltest.osa.com/api/mobile/members/orderDetail 安排的任务 use App\Models\Deliverys\Dlycorp; $logiId = []; $logiId[] = $delivery['logi_id']; $logiCodes = Dlycorp::whereIn('id', array_unique($logiId))->get()->toArray(); $logiCodes = array_column($logiCodes, null, 'id'); foreach ($orderData['deliveries'] as $key => $delivery) { if ($delivery['order_type'] == 2) continue; $orderDetailData['ship_data'][$key]['logi_code'] = $logiCodes[$delivery['logi_id']]['corp_code'] ?? ''; } https://malltest.osa.com/api/mobile/members/orderDetail composer create-project --prefer-dist laravel/lumen lumen-api composer require flipbox/lumen-generator php artisan key:generate php artisan make:model Post -fmc 开发一个排序功能 { "page": 1, "id": "DESC", "rule_id": "DESC", "member_id": "DESC", "image_num": "DESC", "created_at": "DESC", "updated_at": "DESC" } npm i vue-router --save npm i axios --save 25:25 composer self-update 1.8.6 --no-check-certificate send_status 0 全发送 1 全不发送 2 只发送小程序端 3 只发送短信 路由-登录判断-Ajax zi:fenxi-ke, ti-fen+pen-ke-bi+dang-wen course, categories,mti type 颜色:咖啡色-卫衣、尺码:XS http://n.mall-test.com/_debugbar/open?op=get&id=Xc5a5f61fb5c334a6d2f0be06845779ed 目前点击之后,后端会产生一定的数据,后加的数据,区别是 foreach ($data as $key => $item) { if(count($item) < 2) { unset($data[$key]); } } …\packages\weixin\src\Wechat\Basics.php254 {"expire_time":1642753217,"access_token":"53_HP1wcO8Tq0ngFZb51JKyOAwzId0cIHzvgy6tGY-_Ihb3WkoApBkIcvz2jHcrovmprO4CbYJxKsAdcP8qzL61b-GtwuaucEkfVXNbEhvgwnBz5lqHBxo1SJOOO9SR-1CbtAupBlbsrtyrFhUHPHDeAIATLH"} 显示最后200行: tail -n 200 文件名 tail -n 200 laravel-2022-01-25.log 应该要加两个参数, 一个是用户特等奖标记, 一个是用户没有添加过地址或添加过地址可修改状态标记 1/100 https://malltest.osa.com/api/goods/16581/edit?timestamp=1640930264&appkey=1224283400&sign=CC30CB7051150F16565846B225DC496E unable to execute file releaseNotes.html docker run -d -p 80:80 docker/getting-started (队列,可以考虑引入rabbitmq专门处理分布式队列) (后期有时间优化,可以考虑引入调用第三方AI判断接口) (保存虎年图片接口,saveFuImage: id, user_id, json, step, share, give) docker CURD+ES C:\Env\git\tf_mall\app\Http\Controllers\Admin\Marketing git config --global user.name "Hong Jun" git config --global user.email "113075416@qq.com" docker run -d -p 80:80 docker/getting-started 【红包雨】 https://malltest.osa.com/api/admin/marketing/huYearPaintings?page=1&limit=10&timestamp=1641261030&appkey=1224283400&sign=5CCABEFC293C5689D145255C820955C2 https://malltest.osa.com/api/admin/marketing/huYearPaintings/5?timestamp=1641261076&appkey=1224283400&sign=CC30CB7051150F16565846B225DC496E DROP TABLE IF EXISTS `ldb_marketing_hu_year_paintings_player`; 分支 2022-03-25 27 curd, es 导入到处 用户表:ldb_members上传的图片。用json字段保存,中奖字段,获取:手机号、收件人 中奖名单,采用ldb_member_addrs表的menber_id,获取收件地址信息 你熟悉一下赠送优惠券和后台配置的代码,其实你们现在可以开始开发了 composer create-project laravel/laravel=5.6.40 --prefer-dist lara5640 或下载最新版本: composer create-project laravel/laravel --prefer-dist filename http://n.mall-test.com/api/admin/marketing/RedRain {{host}}/api/admin/marketing/HuYearPaintings { "appkey": "1224283400", "bn": [ "9C581063601923", "9C581063601924" ], "timestamp": 1641264685, "sign": "5CCABEFC293C5689D145255C820955C2", "title": "test1" } 后台营销活动系统start* #region 仿鱼塘多销的微信列表模块 Route::middleware('throttle:100000,1')->namespace('Admin\Wechat')->group(function () { Route::resource('/admin/wechat/fishond', 'FishondWechatController'); Route::post('/admin/wechat/fishond/export', 'FishondWechatController@export'); Route::post('/admin/wechat/fishond/import', 'FishondWechatController@import'); }); #endregion #region 团购、秒杀、一口价、预付定金、订单实付满额抽奖、高单立减活动、限时购、前支付多少名送赠品 Route::middleware('throttle:100000,1')->namespace('Admin\Marketing')->group(function () { //新人价福利 Route::resource('/admin/marketing/newUserPrice', 'NewUserPriceController'); Route::post('/admin/marketing/newUserPrice/filter', 'NewUserPriceController@filter'); Route::post('/admin/marketing/newUserPrice/search', 'NewUserPriceController@search'); Route::post('/admin/marketing/newUserPrice/storeGoods', 'NewUserPriceController@storeGoods');//手动添加活动商品数据 Route::post('/admin/marketing/newUserPrice/updateGoods', 'NewUserPriceController@updateGoods');//更新活动商品数据 Route::post('/admin/marketing/newUserPrice/deleteGoods', 'NewUserPriceController@deleteGoods');//删除活动商品数据 }); #endregion http://n.mall-test.com/api/admin/marketing/RedRain/6?timestamp=1641356282&appkey=1224283400&sign=CC30CB7051150F16565846B225DC496E [{"id":1,"iamge_id":1,"title":"图片1","description":"前20名集齐五虎者","quantity":20},{"id":2,"iamge_id":2,"title":"100元优惠券","description":"前20名集齐五虎者","quantity":20}] { "rule_id": 6, "appkey": "1224283400", "timestamp": 1641264685, "sign": "5CCABEFC293C5689D145255C820955C2", "member_id": "test1", "coupon": "rules_description", "member_addrs_id": 1, } public function show(Request $request) { $input = $request->only('id'); $validator = Validator::make($input, [ 'status' => 'required|boolean', ]); if ($validator->fails()) { return $this->failed($validator->errors()); } } \DB::beginTransaction(); $saveRes = HuYearPaintings::create($data); if ($saveRes) { // 其他更新操作 // \DB::commit(); return $this->success($data, 'success', 200, '操作成功'); } \DB::rollBack(); return $this->failed("操作失败,请稍后重试"); "coupon": [{"id":1,"iamge_id":10,"title":"100元优惠券","description":"前20名集齐五虎者","quantity":20}], SQLSTATE[42S22]: Column not found: 1054 Unknown column 'coupon' in 'field list' (SQL: insert into `ldb_marketing_hu_year_paintings_player` (`rule_id`, `member_id`, `coupon`, `member_addrs_id`, `updated_at`, http://n.mall-test.com/api/admin/marketing/memberList [{"location_id":1,"image_id":101},{"location_id":2,"image_id":102}] http://transfer.act.dzpaas.com/activity/guest?AppID=wx5dd134dad31ed489&bgid=&CompanyID=0475&OpenID=[OpenID] 原来:" { "expire_time": 1642673018, "access_token": "53_EHokCBpyFJSLy6QgrtTJwijVKrfqq3zOdoK4k2nLEjpcHvQrkieoc5bxbsyfcy8VUp7TKPsegwdEjSs987S2ZQuGC0zrjZ5LSv6wxAVQ9I_BdD19AAbmh4wBtcLKd_OjouxlVVhnDHxgqUxjGCAcABALHF" } 新的: {"expire_time":1642734952,"access_token":"53_L7n4pDYGSxdMG5mR0aOqFdcnp60Fc86QQ1hIrAtSgLVvahsWgBO52g-fNGhOYFMQ3D_sLE1qIJN6qczGz71pYpL5m3WZDUw77e2Wqm0HbRBAir8nasaVoNaHpIQ2IQHikkg8sj-O0oJrHMoeBTLgAEAQIA"} 加入100 /** * 优惠券规则id的数据设置 * @return mixed */ public static function couponArr() { // 优惠券id和名次 $couponIds = [ 197 => [ "number" => 20, // 1-20名 "name" => "一等奖", ], 198 => [ "number" => 50, // 21-50名 "name" => "二等奖", ], 199 => [ "number" => 100, // 51-100名 "name" => "幸运奖", ], ]; return $couponIds; } /** * 获取排名id对应的优惠券规则id * @return mixed */ public static function couponId($ranking) { // 优惠券规则id的数据设置 $couponArr = self::couponArr(); // 优惠券id和名次 $couponIds = []; foreach ($couponArr as $key => $coupon) { $couponIds[$key] = $coupon['number']; } foreach ($couponIds as $key => $item) { if($ranking <= $item) { $couponId = $key; break; } } return $couponId; } // 优惠券规则id的数据设置 $couponArr = self::couponArr(); $couponData = []; foreach ($couponRudes as $key => $couponRude) { $couponData[$key]['id'] = $couponRude['id'] ?? ''; $couponData[$key]['cpns_type_name'] = $couponRude['cpns_type_name'] ?? ''; $couponData[$key]['cpns_name'] = $couponRude['cpns_name'] ?? ''; $couponData[$key]['cpns_amount'] = $couponRude['cpns_amount']; $couponData[$key]['cpns_max_num'] = $couponRude['cpns_max_num']; $couponData[$key]['level'] = $couponArr[$couponRude['id']]['name']; } if($ranking <= $this->memberMaxNum) { $result = $this->cardSynthesisGiveCoupon($prizeParams); $prizeParams['data']['coupon_status'] = 1; // 1为有赠送 $ruleCoupons = SalesRuleCoupon::where('id', $result['couponId'])->first(); $prizeParams['data']['coupon_rule_id'] = $result['couponId']; $prizeParams['data']['coupon_store'] = $result['cpnsStore']; $prizeParams['data']['coupon_name'] = $ruleCoupons['cpns_name']; $prizeParams['data']['cpns_amount'] = $ruleCoupons['cpns_amount']; $prizeParams['data']['cpns_max_num'] = $ruleCoupons['cpns_max_num']; $sendNotice = 1; } else { $result = $this->cardSynthesisNoCoupon($prizeParams); $prizeParams['data']['coupon_status'] = 2; // 2为无赠送 } ^ array:30 [ 0 => array:2 [ 0 => "颜色:白色" 1 => "尺码:XXL" ] 1 => array:2 [ 0 => "颜色:白色" 1 => "尺码:XL" ] 2 => array:2 [ 0 => "颜色:白色" 1 => "尺码:XS" ] 3 => array:2 [ 0 => "颜色:白色" 1 => "尺码:S" ] 4 => array:2 [ 0 => "颜色:白色" 1 => "尺码:M" ] 5 => array:2 [ 0 => "颜色:白色" 1 => "尺码:L" ] 6 => array:2 [ 0 => "颜色:红色" 1 => "尺码:XXL" ] 7 => array:2 [ 0 => "颜色:红色" 1 => "尺码:XL" ] 8 => array:2 [ 0 => "颜色:红色" 1 => "尺码:XS" ] 9 => array:2 [ 0 => "颜色:红色" 1 => "尺码:S" ] 10 => array:2 [ 0 => "颜色:红色" 1 => "尺码:M" ] 11 => array:2 [ 0 => "颜色:红色" 1 => "尺码:L" ] 12 => array:2 [ 0 => "颜色:绿色" 1 => "尺码:XXL" ] 13 => array:2 [ 0 => "颜色:绿色" 1 => "尺码:XL" ] 14 => array:2 [ 0 => "颜色:绿色" 1 => "尺码:XS" ] 15 => array:2 [ 0 => "颜色:绿色" 1 => "尺码:S" ] 16 => array:2 [ 0 => "颜色:绿色" 1 => "尺码:M" ] 17 => array:2 [ 0 => "颜色:绿色" 1 => "尺码:L" ] 18 => array:2 [ 0 => "颜色:牛仔蓝色" 1 => "尺码:XXL" ] 19 => array:2 [ 0 => "颜色:牛仔蓝色" 1 => "尺码:XL" ] 20 => array:2 [ 0 => "颜色:牛仔蓝色" 1 => "尺码:XS" ] 21 => array:2 [ 0 => "颜色:牛仔蓝色" 1 => "尺码:S" ] 22 => array:2 [ 0 => "颜色:牛仔蓝色" 1 => "尺码:M" ] 23 => array:2 [ 0 => "颜色:牛仔蓝色" 1 => "尺码:L" ] 24 => array:1 [ 0 => "尺码:XXL" ] 25 => array:1 [ 0 => "尺码:XL" ] 26 => array:1 [ 0 => "尺码:XS" ] 27 => array:1 [ 0 => "尺码:S" ] 28 => array:1 [ 0 => "尺码:M" ] 29 => array:1 [ 0 => "尺码:L" ] ]