isGet()) $this->forthMenu(); } /** * Common: 进入发布小程序 * Author: wu-hui * Time: 2023/01/03 17:05 * @return array|mixed * @throws \think\db\exception\DbException */ public function index(){ if(request()->isAjax()) return (new appletReleaseModel($this->site_id))->getList(); $config = new Config(); $config_info = $config->getAppConfig($this->site_id)['data']['value']; $baseinfo=[]; $is_baseinfo=1; if(!empty($config_info['line_type'])&&$config_info['line_type']=='auth'){ $app = new MinCode(); $app->appAuthToken = $config_info['app_auth_token']; $baseinfo = cache($app->appAuthToken . '_baseinfo'); if (empty($baseinfo)) { $baseinfo = $app->requestApi('alipay.open.mini.baseinfo.query')['alipay_open_mini_baseinfo_query_response']; cache($app->appAuthToken . '_baseinfo', $baseinfo); } if(!isset($baseinfo['category_names'])){ $is_baseinfo=0; } } $this->assign('is_baseinfo',$is_baseinfo); $this->assign('baseinfo',$baseinfo); // 最新版本 $this->assign('isNewest',(new AliPayApplet($this->site_id))->isNewestVersion()); return $this->fetch('release/index'); } /** * Common: 小程序发布流程处理 * Author: wu-hui * Time: 2023/01/04 11:05 * @return array */ public function publishingProcessProcessing(){ // 参数获取 $type = (string)input('type'); $id = (int)input('id'); return (new AliPayApplet($this->site_id))->publishingInit($type,$id); } /** * Common: 版本管理 —— 版本同步 * Author: wu-hui * Time: 2022/12/30 10:08 * @return array * @throws \Exception */ public function versionSynchronization(){ return (new AliPayApplet($this->site_id))->versionSynchronization(); } /** * Common: 生成小程序推广二维码 * Author: wu-hui * Time: 2023/01/03 14:13 * @return array */ public function qrcodeCreate(){ $version=config('alipay.templateInfo.template_version'); return (new AliPayApplet($this->site_id))->queryTestQrcode($version); } public function demo(){ // 订单中心消息 模拟发送信息 // $zmOrderId = 42;// zm_order 订单表id // $orderStatus = 'REFUNDED';// 订单状态: // $refundPath = '花呗';// 款到账的路径 // $res = (new AliPayMessage($this->site_id))->orderSynchronization($zmOrderId,$orderStatus,$refundPath); event("NoticeImpendingExpiration"); debug("结束"); // INTEREST_EXPIRATION_NOTICE 权益即将过期通知 //--- SERVICE_OPENED_SUCCESS 服务开通成功提醒 //--- VERIFY 核销提醒 $data = [ 'goods_name' => '商品名称', 'store_name' => '店铺名称', 'start_time' => '2023年1月8日', 'content' => '具体内容', 'end_time' => '2023年1月10日', 'nickname' => '用户昵称', 'surplus' => '剩余3次', ]; // 订阅消息发送 $res = (new AliPayMessage($this->site_id))->sendMessage(18,'INTEREST_EXPIRATION_NOTICE',[ 'store_name' => '2023年1月10日',// 商家名称 'surplus' => '用户昵称',// 剩余次数 'content' => '2023年1月8日',// 优惠内容 ]); // 开启计划任务 // $cronWhere = [ // 'event' => 'HandleArticleMessage', // ]; // $cronId = model('cron')->getValue($cronWhere,'id'); // if($cronId <= 0) (new Cron())->addCron(2, 5, "处理文章通知消息", "HandleArticleMessage", time(),0); debug(['返回信息',$res]); } }