PHP根據問題追蹤代碼技巧一

一、問題描述:php

二、E:\html\pim\php_aspire-mcloud\module\pim\controller\Configure.class.phphtml

public function popupGetAction( $params ) { $keys = array( self::KEY_CLIENT_ID, self::KEY_SESSION, self::KEY_VERSION, self::KEY_DEVICE_ID, self::KEY_FROM ); parent::checkBaseParam($params, $keys); $params->useEnv = '1';  //是否區分環境
        $params->type = 'activity_popup_config';  //相對於pms yellowPage.php 裏面popupConfig方法
        $return = Service_Configure::getConfigureByType($params); $user = Util_User::getInstance(); $mobile = $user->getMobile(); $authHelper = new Auth_Helper(); $authHelper->{Auth_Helper::KEY_MOBILE} = $mobile; $returns = $authHelper->operatorGet(); $provinceId = $returns['data']['provCode']; $cityId = $returns['data']['regionCode']; $operator = $returns['data']['operator']; //安卓版本限制
        if (isset($return['android_version']) && $return['android_version']) { if ($params->{self::KEY_CLIENT_ID} == '4') { $allow_android_version_arr = explode(',', $return['android_version']); if (!in_array($params->{self::KEY_VERSION}, $allow_android_version_arr)) { return array(); } } } //ios版本限制
        if (isset($return['ios_version']) && $return['ios_version']) { if ($params->{self::KEY_CLIENT_ID} == '1') { $allow_ios_version_arr = explode(',', $return['ios_version']); if (!in_array($params->{self::KEY_VERSION}, $allow_ios_version_arr)) { return array(); } } } //運營商限制
        if (isset($return['operator']) && !empty($return['operator']) && !in_array($operator, $return['operator'])) { return array(); } //地市限制
        if (isset($return['region']) && !empty($return['region'])) { $sign = false; foreach ($return['region'] as $region) { if ($region[0] == "" || ($region[0] == $provinceId && ($region[1] == "" || $region[1] == $cityId))) { $sign = true; break; } } if ($sign == false) { return array(); } } if ($return['switchValue'] == 1) {  //無彈框
            return array(); } elseif ($return['switchValue'] == 2) {  //微力活動彈框
            $param = array('mobi' => $mobile); if (isset($return['whost']) && $return['whost']) { $url = $return['whost']; } else { $_conf = Rpc_Context::getConfig(); $config = include ($_conf['config_path'] . 'wxactivity.config.php'); $host = $config['hosts'][APPLICATION_ENV]; $url = rtrim($host, '/').'/open/txl_api/multi_call_popup'; } $h = new Util_Curl($url); $r = $h->httpPost($param, false, array('content-type:application/x-www-form-urlencoded'))->getResponse(); $result = json_decode($r, true); if (isset($result['code']) && $result['code'] == 0) { return array( 'id' => strval($result['data']['id']),
                    'title' => $result['data']['title'],
                    'content' => $result['data']['content'],
                    'link' => $result['data']['button_url'],
                    'text' => $result['data']['button_name'], ); } else { return array(); } } else {  //自定義彈框
            return $return['defineActivityInfo']; } }

 

適配服務請求pms平臺mysql

E:\html\pim\php_aspire-mcloud\configure\officialdb.config.phpandroid

<?php return array( 'hosts' => array( 'development'     => 'http://pms.svn.com',//本地svn環境
            'qa'             => 'http://pms.qa.cytxl.com.cn',//10.9.20.65 pms.qa.cytxl.com.cn
            'test'            => 'http://pms.cytxl.com.cn',    //192.168.19.32 pms.cytxl.com.cn
            'production'    => 'http://pms.cytxl.com.cn'    //172.16.79.10 pms.cytxl.com.cn
    ),
    'appkey' => '470004', );

 

mysql --default-character-set=utf8 -utxl_pms_user -h192.168.2.116 -ppms#@139com! -P3307 -D txl_pms
mysql> select content from config where type = 'activity_popup_config_plus';
{"switchValue":"2","defineActivityInfo":{"id":"haha","title":"\u5f55\u54e5\u6709\u793c\u8fd9\u662f\u4e0d\u80fd\u4e2d\u5956\u7684\u94fe\u63a5\u7eaf\u6d4b\u5f39\u7a97","content":"\u606d\u559c\u5c0f\u4e3b\u83b7\u5f97300\u5206\u949f\u591a\u65b9\u7535\u8bdd~ \u798f\u5229\u5df2\u53d1\u51fa~","link":"http:\/\/1.activity.cytxl.com.cn\/static\/html\/super_lottery\/h5\/multi_call\/index.html?super_lottery_id=48","text":"\u731b\u6233\u9886\u53d6"},"whost":"","android_version":"","ios_version":"","operator":["CM","CT","CU"],"region":[["",""]]}

適配服務請求微力平臺ios

E:\html\pim\php_aspire-mcloud\configure\wxactivity.config.phpsql

<?php /** * 微力活動 配置參數 */
return array( 'hosts' => array( 'development'     => 'http://1.activity.cytxl.com.cn',
        'qa'             => 'http://1.activity.cytxl.com.cn',
        'test'            => 'https://activity1.cytxl.com.cn',    
        'production'    => 'https://activity.cytxl.com.cn' ), );

 

E:\html\pim\php_weili_activities\application\controllers\open\txl_api.phpjson

public function multi_call_popup(){ $mobi = $this->input->post('mobi'); $multi_call = $this->super_lottery_model->get_multi_call(); if (!$multi_call){ return $this->send_json(false,'查無活動信息或不在活動時間內'); } $limit_goal_arr = array( 'super_lottery_id'=>$multi_call->id,
                'prize_type !='=>SPLT_PRIZE_TYPE_THANKS,
                'mobi' => $mobi, ); $goal_counts = $this->super_lottery_result_model->count('',$limit_goal_arr); if ($goal_counts > 0) { //已中獎
            return $this->send_json(false,'用戶已中獎!'); } $ret = array( 'id' => strval($multi_call->id),
                'title' => $multi_call->pop_up_title,
                'point'=>'',
                'content'=>$multi_call->pop_up_content,
                'button_name'=>$multi_call->pop_up_button_name,
                'button_url'=>base_url('static/html/super_lottery/h5/multi_call/index.html?super_lottery_id='.$multi_call->id) ); return $this->send_json(true,'',$ret); }
相關文章
相關標籤/搜索