1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /**
- * MpAdTestController.php UTF-8
- * 广告数据上报测试
- *
- * @date : 2018/11/16 14:29
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : chenbingling <cbl@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace mini\sdk\controller;
- use huo\controller\pay\SdkOrderCache;
- use huo\model\member\MemoauthModel;
- use huolib\status\CommonStatus;
- use huoMpAd\MpOpenMkt;
- use think\Controller;
- class MpAdTestController extends Controller {
- public function index() {
- // $_app_id = 2;
- // $_ma_out = new MpAdOut();
- // $_rs = $_ma_out->createDataSource($_app_id);
- // if (CommonStatus::NO_ERROR != $_rs['code']) {
- // $_rs['msg'] = '创建数据源错误:'.$_rs['msg'];
- // print_r($_rs);
- // exit;
- // }
- // $_action_data = [];
- // $_action_data['user_action_set_id'] = $_rs['data']['user_action_set_id'];
- // $_action_data['click_id'] = 'qwerasujdexswesw';
- // $_action_data['url'] = 'http://www.page/index/index';
- // $_rs = $_ma_out->dataReport($_app_id, $_action_data);
- // if (CommonStatus::NO_ERROR != $_rs['code']) {
- // $_rs['msg'] = '回传数据错误:'.$_rs['msg'];
- // print_r($_rs);
- // exit;
- // }
- // $this->success(lang('SUCCESS'));
- $this->payTest();
- }
- protected function payTest() {
- // 付费回传
- $_app_id = 7;
- $_ma_out = new MpOpenMkt();
- $_rs = $_ma_out->createDataSource($_app_id);
- if (CommonStatus::NO_ERROR != $_rs['code']) {
- $_rs['msg'] = '创建数据源错误:'.$_rs['msg'];
- print_r($_rs);
- exit;
- }
- $_order_id = 'g1614146601423450098';
- $_order_info = (new SdkOrderCache())->getInfoByOrderId($_order_id);
- $_openid = (new MemoauthModel())->getOpenIdByMpMemId($_ma_out->getConfId(), $_order_info['mem_id']);
- $_action_data = [];
- $_action_data['user_action_set_id'] = $_rs['data']['user_action_set_id'];
- $_action_data['action_type'] = 'PURCHASE';
- $_action_data['openid'] = $_openid;
- $_action_data['action_param_value'] = $_order_info['amount'];
- $_rs1 = $_ma_out->dataReport($_app_id, $_action_data);
- dump($_rs1);
- $_rs2 = $_ma_out->getDataSourceReport($_app_id, '2021-02-24','2021-02-24');
- halt($_rs2);
- }
- }
|