diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 66dcc7489..687ec4204 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -85,7 +85,7 @@ function get_list_field($data, $grid) /** * [every_day 获取日期] - * @param integer $m [description] + * @param integer $m [description] * @return [type] [array] */ function every_day($m = 7) @@ -293,7 +293,6 @@ function get_config_group($group = 0) * '字段名2'=>array(映射关系数组), * ...... * ) - * @author 朱亚杰 * @return array * * array( @@ -301,6 +300,7 @@ function get_config_group($group = 0) * .... * ) * + * @author 朱亚杰 */ function int_to_string(&$data, $map = array('status' => array(1 => '正常', -1 => '删除', 0 => '锁定', 2 => '未审核', 3 => '草稿'))) { @@ -365,7 +365,7 @@ function get_parent_category($cid) /** * 检测验证码 - * @param integer $id 验证码ID + * @param integer $id 验证码ID * @return boolean 检测结果 * @author 麦当苗儿 */ @@ -522,3 +522,9 @@ function get_action_type($type, $all = false) return $list[$type]; } +//获取服务器类型 +function getServerType($serverType) +{ + return (($serverType == 1) ? '专服' : '混服'); +} + diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index b45cdcb4e..cf9a4d977 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -40,6 +40,10 @@ class GameController extends ThinkController $extend['sdk_version'] = $_REQUEST['sdk_version1']; unset($_REQUEST['sdk_version1']); } + if (!empty($_REQUEST['server_type'])) { + $extend['server_type'] = intval($_REQUEST['server_type']); + unset($_REQUEST['server_type']); + } if (isset($_REQUEST['recommend_status'])) { $extend['recommend_status'] = $_REQUEST['recommend_status']; unset($_REQUEST['recommend_status']); diff --git a/Application/Admin/Controller/PersonalMenusController.class.php b/Application/Admin/Controller/PersonalMenusController.class.php new file mode 100644 index 000000000..c5ac9f2d9 --- /dev/null +++ b/Application/Admin/Controller/PersonalMenusController.class.php @@ -0,0 +1,137 @@ +where(['name' => 'personal_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + foreach($config as $k => $v) + { + $config[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + } + } + $this->assign('list',$config); + $this->meta_title = '个人中心列表'; + $this->display('lists'); + } + + public function add() + { + $sdkMenus = M('tool','tab_')->where(['name' => 'personal_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + $config1 = $config; + $id = array_pop($config1); + $id = $id['id'] + 1; + }else + { + $config = []; + $id = 1; + } + + if(IS_POST) + { + $post = I('post.'); + $post['id'] = $id; + array_push($config,$post); + $sdkMenus['config'] = json_encode($config); + if(empty($sdkMenus['name'])) + { + $sdkMenus['name'] = 'personal_menu'; + $sdkMenus['title'] = '个人中心列表'; + $sdkMenus['status'] = 1; + $sdkMenus['create_time'] = time(); + M('tool','tab_')->data($sdkMenus)->add(); + }else + { + M('tool','tab_')->where(['name' => 'personal_menu'])->data($sdkMenus)->save(); + } + $this->success('新增成功', U('lists')); + } + + $data['sort'] = $id; + $this->meta_title = '个人中心列表'; + $this->assign('type','add'); + $this->assign('data',$data); + $this->display('add'); + } + + public function edit($id) + { + $sdkMenus = M('tool','tab_')->where(['name' => 'personal_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(IS_POST) + { + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $post = I('post.'); + foreach($post as $key => $val) + { + if($key == 'icon') + { + $config[$k][$key] = strstr($val,'/Upload'); + }else + { + $config[$k][$key] = $val; + } + } + break; + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'personal_menu'])->data($sdkMenus)->save(); + $this->success('修改成功', U('lists')); + } + $data = []; + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $v['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + $data = $v; + break; + } + } + if(empty($data)) + { + $this->error('菜单不存在','lists'); + } + $this->meta_title = '个人中心列表'; + $this->assign('type','edit'); + $this->assign('data',$data); + $this->display('add'); + } + + + public function del($id) + { + if(!is_array($id)) + { + $data[] = $id; + }else + { + $data = $id; + } + $sdkMenus = M('tool','tab_')->where(['name' => 'personal_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + foreach($config as $k => $v) + { + if(in_array($v['id'], $data)) + { + unset($config[$k]); + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'personal_menu'])->data($sdkMenus)->save(); + $this->success('删除成功', U('lists')); + } + +} \ No newline at end of file diff --git a/Application/Admin/Controller/SdkMenuController.class.php b/Application/Admin/Controller/SdkMenuController.class.php new file mode 100644 index 000000000..43c9d8c52 --- /dev/null +++ b/Application/Admin/Controller/SdkMenuController.class.php @@ -0,0 +1,135 @@ +where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + foreach($config as $k => $v) + { + $config[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + } + } + $this->assign('list',$config); + $this->meta_title = '悬浮球菜单'; + $this->display('lists'); + } + + public function add() + { + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + $config1 = $config; + $id = array_pop($config1); + $id = $id['id'] + 1; + }else + { + $config = []; + $id = 1; + } + + if(IS_POST) + { + $post = I('post.'); + $post['id'] = $id; + array_push($config,$post); + $sdkMenus['config'] = json_encode($config); + if(empty($sdkMenus['name'])) + { + $sdkMenus['name'] = 'sdk_menu'; + $sdkMenus['title'] = '悬浮球菜单'; + M('tool','tab_')->data($sdkMenus)->add(); + }else + { + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + } + $this->success('新增成功', U('lists')); + } + + $data['sort'] = $id; + $this->meta_title = '悬浮球菜单'; + $this->assign('type','add'); + $this->assign('data',$data); + $this->display('add'); + } + + public function edit($id) + { + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(IS_POST) + { + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $post = I('post.'); + foreach($post as $key => $val) + { + if($key == 'icon') + { + $config[$k][$key] = strstr($val,'/Upload'); + }else + { + $config[$k][$key] = $val; + } + } + break; + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('修改成功', U('lists')); + } + $data = []; + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $v['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + $data = $v; + break; + } + } + if(empty($data)) + { + $this->error('菜单不存在','lists'); + } + $this->meta_title = '悬浮球菜单'; + $this->assign('type','edit'); + $this->assign('data',$data); + $this->display('add'); + } + + + public function del($id) + { + if(!is_array($id)) + { + $data[] = $id; + }else + { + $data = $id; + } + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + foreach($config as $k => $v) + { + if(in_array($v['id'], $data)) + { + unset($config[$k]); + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('删除成功', U('lists')); + } + +} \ No newline at end of file diff --git a/Application/Admin/View/Game/lists.html b/Application/Admin/View/Game/lists.html index 5234f489a..eae185a53 100644 --- a/Application/Admin/View/Game/lists.html +++ b/Application/Admin/View/Game/lists.html @@ -85,6 +85,13 @@ text-indent:0; +
+ +
专服 + + 混服 + + + + + + 开放类型 diff --git a/Application/Admin/View/PersonalMenus/add.html b/Application/Admin/View/PersonalMenus/add.html new file mode 100644 index 000000000..04c6ca8da --- /dev/null +++ b/Application/Admin/View/PersonalMenus/add.html @@ -0,0 +1,152 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
菜单名称 + +
菜单标题 + +
菜单链接 + +
url类型 + + + +
跳转目标 + +
IOS链接 + +
排序 + +
菜单图标 + + + +
+ +
+ +
+
+
+
+ 菜单图标 +
+ + + + + + +
+ + + 返回 + +
+ +
+ +
+ + + diff --git a/Application/Admin/View/PersonalMenus/lists.html b/Application/Admin/View/PersonalMenus/lists.html new file mode 100644 index 000000000..8e5d9f1e8 --- /dev/null +++ b/Application/Admin/View/PersonalMenus/lists.html @@ -0,0 +1,177 @@ + + + + + + + +
+
+ 新增 + 删 除 +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ID菜单名称菜单标题菜单图标菜单链接url类型跳转目标IOS链接排序操作
{$channel.id}{$channel.name}{$channel.title}{$channel.url}原生H5页面{$channel.act}{$channel.ios_url} +
+ {$channel.sort} +
+
+ 编辑 + 删除 +
aOh! 暂时还没有内容!
+
+
+ {$_page|default=''} +
+ + + + +
+ + + + + + \ No newline at end of file diff --git a/Application/Admin/View/SdkMenu/add.html b/Application/Admin/View/SdkMenu/add.html new file mode 100644 index 000000000..04c6ca8da --- /dev/null +++ b/Application/Admin/View/SdkMenu/add.html @@ -0,0 +1,152 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
菜单名称 + +
菜单标题 + +
菜单链接 + +
url类型 + + + +
跳转目标 + +
IOS链接 + +
排序 + +
菜单图标 + + + +
+ +
+ +
+
+
+
+ 菜单图标 +
+ + + + + + +
+ + + 返回 + +
+ +
+ +
+ + + diff --git a/Application/Admin/View/SdkMenu/lists.html b/Application/Admin/View/SdkMenu/lists.html new file mode 100644 index 000000000..f246a381c --- /dev/null +++ b/Application/Admin/View/SdkMenu/lists.html @@ -0,0 +1,178 @@ + + + + + + + +
+ +
+ 新增 + 删 除 +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ID菜单名称菜单标题菜单图标菜单链接url类型跳转目标IOS链接排序操作
{$channel.id}{$channel.name}{$channel.title}{$channel.url}原生H5页面{$channel.act}{$channel.ios_url} +
+ {$channel.sort} +
+
+ 编辑 + 删除 +
aOh! 暂时还没有内容!
+
+
+ {$_page|default=''} +
+ + + + +
+ + + + + + \ No newline at end of file diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index c87284739..a2c806fe8 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -61,7 +61,7 @@ function str2arr($str, $glue = ',') * @return string * @author 麦当苗儿 */ -function arr2str($arr, $glue = ',') +function arr2str($arr=[], $glue = ',') { return implode($glue, $arr); } diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index fdcea7856..d4774857b 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -270,9 +270,9 @@ class PromoteController extends BaseController //$count = M("server", "tab_")->where($map)->count(); foreach ($open_server_list as $key => $server) { $open_server_list[$key]['icon'] = get_cover($server['icon'], 'path'); - if ($server['pay_type'] == 1) { + if ($server['server_version'] == 1) { $open_server_list[$key]['pay_type'] = '安卓'; - } elseif ($server['pay_type'] == 1) { + } elseif ($server['server_version'] == 2) { $open_server_list[$key]['pay_type'] = 'iOS'; } else { $open_server_list[$key]['pay_type'] = '安卓、iOS'; @@ -315,7 +315,7 @@ class PromoteController extends BaseController )->delete(); $this->ajaxReturn(['status' => 1, 'info' => '移除成功'], "JSON"); } else { - $menuData = M("promote_quick_menu ", "tab_")->count(); + $menuData = M("promote_quick_menu ", "tab_")->where(array("promote_id" => get_pid()))->count(); if ($menuData>=10) { $this->ajaxReturn(['status' => 1, 'info' => '快捷菜单只能有10个'], "JSON"); diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index d5b30fd31..81314ae8d 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2303,14 +2303,8 @@ class QueryController extends BaseController public function getChildPromoteList() { - $promoteId = I('post.promote_id', 0); - if ($promoteId == 0) { - $data['status'] = 0; - $data['msg'] = '数据异常'; - - $this->ajaxReturn($data); - } - + $promoteId = intval(I('post.promote_id', 0)); + $promoteId = empty($promoteId) ? PID : $promoteId; $promoteList = getAllPromoteListByType(3, false, $promoteId); $data['status'] = 1; $data['data'] = $promoteList; diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index 55be6005b..820581c44 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -31,15 +31,15 @@ class TestResourceController extends BaseController $map['tab_test_resource.role_name']=['like','%'.I('role_name').'%']; } if(!empty(I('user_account'))){ - $map['tab_test_resource.user_account']=I('user_account'); + $map['tab_test_resource.user_account']=['like','%'.I('user_account').'%']; } if(!empty(I('promote_name'))){ - $map['tab_test_resource.promote_account']=I('promote_name'); + $map['tab_test_resource.promote_account']=['like','%'.I('promote_name').'%']; } $map['user.promote_id']=session("promote_auth.pid"); $data = M('test_resource','tab_') - ->field('tab_test_resource.id,tab_test_resource.user_id,tab_test_resource.game_name,tab_test_resource.server_name,tab_test_resource.user_account,tab_test_resource.promote_account,tab_test_resource.role_name,tab_test_resource.create_time,device_number,check_status') + ->field('tab_test_resource.id,tab_test_resource.user_id,tab_test_resource.game_name,tab_test_resource.server_name,tab_test_resource.user_account,tab_test_resource.promote_account,tab_test_resource.role_name,tab_test_resource.create_time,device_number,lock_status as check_status') ->join('left join tab_user as user on tab_test_resource.user_id = user.id') ->where($map) ->page($page,$row) @@ -74,7 +74,7 @@ class TestResourceController extends BaseController } $data = [ - 'check_status' => 0 + 'lock_status' => 0 ]; $isFreeze = M('user','tab_')->where("id=".$supportId)->save($data); @@ -93,7 +93,7 @@ class TestResourceController extends BaseController } $data = [ - 'check_status' => 1 + 'lock_status' => 1 ]; $isFreeze = M('user','tab_')->where("id=".$supportId)->save($data); @@ -246,7 +246,7 @@ class TestResourceController extends BaseController parent::_initialize(); $map['id'] = get_pid(); $pro = M("promote", "tab_")->where($map)->find(); - if ($pro['parent_id']!=0) { + if ($pro['parent_id']!=0&&!($pro['parent_id']>0&&$pro['grand_id']==0)) { $this->error('无权操作!'); } } @@ -282,6 +282,9 @@ class TestResourceController extends BaseController $map['create_time'] = array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); unset($_REQUEST['start']);unset($_REQUEST['end']); } + + $map['test.promote_id'] = get_pid(); + // $res = D("test_resource")->getResourceCout($map,$page,$row); // dump($res); diff --git a/Application/Home/Model/TestResourceModel.class.php b/Application/Home/Model/TestResourceModel.class.php index d1d729355..44cfe3928 100644 --- a/Application/Home/Model/TestResourceModel.class.php +++ b/Application/Home/Model/TestResourceModel.class.php @@ -47,7 +47,7 @@ class TestResourceModel extends Model{ if(empty($res)){ return $res; } - $rescount = $this + $rescount = $this->table("tab_test_resource as test") ->where($map) ->group("user_id,game_id,server_id") ->buildSql(); diff --git a/Application/Home/View/default/Article/article/detail.html b/Application/Home/View/default/Article/article/detail.html index 136aaa636..587f308ab 100644 --- a/Application/Home/View/default/Article/article/detail.html +++ b/Application/Home/View/default/Article/article/detail.html @@ -1,13 +1,26 @@ - + + +
+
+
+ 返回 +
{$info.title}
diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index bbedcd85d..4e2065a3c 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -167,9 +167,9 @@ - + {$data.game_name} - 安卓、iOS安卓iOS + 安卓、iOS安卓iOS {$data.start_time|date="m-d H:i",###} {$data.server_name} @@ -222,7 +222,7 @@ $.each(result.data, function (index, item) { if(index==0){ show="" + - "" + + "" + ""+item.game_name+"" + ""+item.pay_type+"" + ""+item.start_time+"" + @@ -230,7 +230,7 @@ "" }else{ show+="" + - "" + + "" + ""+item.game_name+"" + ""+item.pay_type+"" + ""+item.start_time+"" + diff --git a/Application/Home/View/default/Promote/quick_menu_list.html b/Application/Home/View/default/Promote/quick_menu_list.html index dbf9f99c4..d4b74b528 100644 --- a/Application/Home/View/default/Promote/quick_menu_list.html +++ b/Application/Home/View/default/Promote/quick_menu_list.html @@ -52,7 +52,11 @@ dataType: 'JSON', cache: false, success: function (result) { - layer.alert(result.info,{},function (idex) { + layer.alert(result.info,{ + end:function () { + location.reload() + }, + },function (idex) { parent.layer.close(idex); if (result.status==1){ location.reload() diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index edbb370ae..0b91d3371 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -47,8 +47,8 @@ 推广员管理
- - + + - - + + - + +
+ + + + + + + \ No newline at end of file diff --git a/Application/Mobile/View/Ssg/index.html b/Application/Mobile/View/Ssg/index.html index 323382d96..a15c89706 100644 --- a/Application/Mobile/View/Ssg/index.html +++ b/Application/Mobile/View/Ssg/index.html @@ -6,7 +6,7 @@ - 超级签购买界面 + 超级签首页 @@ -134,7 +134,7 @@ var index = { getgamelist(){ $.ajax({ type: 'POST', - url: 'mobile.php?s=/Ssg/getGamaList.html', + url: 'mobile.php/Ssg/getGamaList.html', dataType: 'JSON', data:index.select, success: function (result) { @@ -181,11 +181,11 @@ $(".pay-button").on("click",function(){ if(inres > -1){ alert("亲~您已购买过了~请到【订单查询】查看订单信息哟~"); }else{ - location.href = "/sdk.php/Ipa365/pay/game_id/"+index.choose.game_id; + location.href = "mobile.php/Ssg/pay/game_id/"+index.choose.game_id; } }) $("#logout").on("click",function(){ - location.href = "mobile.php?s=/Ssg/logout.html"; + location.href = "mobile.php/Ssg/logout.html"; }) function throttle(fun, delay) { diff --git a/Application/Mobile/View/Ssg/install_show.html b/Application/Mobile/View/Ssg/install_show.html new file mode 100644 index 000000000..563332679 --- /dev/null +++ b/Application/Mobile/View/Ssg/install_show.html @@ -0,0 +1,75 @@ + + + + + + + + 订单详情 + + + + + +
+ +
{$game['game_name']}
+
+
+
+
+
+ +
+
{$game['game_name']}-超级签
+
不同设备需要分别付费安装哦,请使用常用设备下载
+ +
+ + +
+
+
+

特权礼包

+
+
+
    +
  • +
    +

    {$giftbag['gift_name']}

    +
    +

    {$giftbag['desribe']}

    +

    + + + 复制兑换码 +

    +
  • + +
+
+
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/Application/Mobile/View/Ssg/login.html b/Application/Mobile/View/Ssg/login.html index 69c967d27..b7553fe45 100644 --- a/Application/Mobile/View/Ssg/login.html +++ b/Application/Mobile/View/Ssg/login.html @@ -17,7 +17,7 @@
- +
@@ -115,9 +123,7 @@
-
-
@@ -133,7 +139,7 @@
- +
@@ -155,20 +161,136 @@
- +
+ +
+
+ +
忘记密码
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ 获取验证码 +
+
+ + + +
+
+ + + + + + + + + +
+ +
{$game_name}
+
+
+ +
+
+
+
超级签购买
+
订单描述:{$order_id}
+
应付金额:{$price}
+
+
+ +
+

请选择支付方式。建议选择使用支付宝、微信支付、银行卡,支付请直接点击相应付款按钮。如果您使用支付宝账户支付,请点击“支付宝”按钮。

+

如果您选择支付宝、微信支付、银行卡支付时,请遵守相关支付宝、微信支付、财付通的规定进行操作。您在支付宝、微信支付、财付通页面上进行的任何操作及其产生的

+

任何法律后果,将按照您与支付宝、微信支付、银行卡之间签订的合同处理。本网站不承担任何责任。

+
+
+
+
+ + + +
+
+
+
+
订单名称:
+
超级签购买
+
+
+
订单金额:
+
{$price}元
+
+
+
+ +
+ + + + \ No newline at end of file diff --git a/Application/Sdk/Controller/Ipa365Controller.class.php b/Application/Sdk/Controller/Ipa365Controller.class.php index 00780a156..c317d9cdf 100644 --- a/Application/Sdk/Controller/Ipa365Controller.class.php +++ b/Application/Sdk/Controller/Ipa365Controller.class.php @@ -7,168 +7,313 @@ use Mobile\Controller\SsgController; // a8eeac3335cef5ee117d357738598f691932513b class Ipa365Controller extends BaseController{ - const signprice = 10; // 超级签价格 - public $userinfo; - - public function __construct() { - $this->userinfo = $_SESSION['onethink_home']['user_auth']; - parent::__construct(); - } - + const signprice = 0.01; // 超级签价格 + public $userinfo; + + public function __construct() { + $this->userinfo = $_SESSION['onethink_home']['user_auth']; + parent::__construct(); + } + public function test(){ - $user = $this->userinfo; - pp($user); - die(); - $ipa365 = new Ipa365Controller(); - $result = $ipa365->pay_notify(array( - 'trade_id' => "2222", - 'order_id' => "SS_20190924170241aEYL" - )); - - pp($result); - - die(); - $userId = 1; - $gameId = 1; - - $param['price'] = 0.01; - - $param['spend_ip'] = get_client_ip(); - $param['sdk_version'] = '2'; - $param['user_id'] = $userId; - $param['game_id'] = $gameId; - $param['order_id'] = $orderId; - $param['apitype'] = "alipay"; - $param['config'] = "alipay"; - $param['signtype']= "MD5"; - $param['server'] = "alipay.wap.create.direct.pay.by.user"; - $param['payway'] = 1; - $param['title'] = $price; - $param['body'] = $price; - $param['callback'] = "http://www.baidu.com"; - $param['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/sq_callback"; - $ret = $this->alipay($param); - redirect($ret['url']); - die; - - /* $ipa365 = new Ipa365(); - $list = $ipa365->ticketList(array( - 'token' => 'Ido9idMgbZlJHMQxjSgTHWZMB00PFEus', - 'limit' => 1, - )); - - pp($list['data']['list'][0]); */ - // 授予udid下载权限并获取下载地址 - $ret = $ipa365->udidRequest(array( - 'token' => 'Ido9idMgbZlJHMQxjSgTHWZMB00PFEus', - 'udid' => 'a8eeac3335cef5ee117d357738598f691932513b', - )); - pp($ret); - $ret = $ipa365->getinfo(array( - 'token' => 'Ido9idMgbZlJHMQxjSgTHWZMB00PFEus', - 'udid' => 'a8eeac3335cef5ee117d357738598f691932513b', - )); - pp($ret); + $user = $this->userinfo; + pp($user); + die(); + $ipa365 = new Ipa365Controller(); + $result = $ipa365->pay_notify(array( + 'trade_id' => "2222", + 'order_id' => "SS_20190924170241aEYL" + )); + + pp($result); + + die(); + $userId = 1; + $gameId = 1; + + $param['price'] = 0.01; + + $param['spend_ip'] = get_client_ip(); + $param['sdk_version'] = '2'; + $param['user_id'] = $userId; + $param['game_id'] = $gameId; + $param['order_id'] = $orderId; + $param['apitype'] = "alipay"; + $param['config'] = "alipay"; + $param['signtype']= "MD5"; + $param['server'] = "alipay.wap.create.direct.pay.by.user"; + $param['payway'] = 1; + $param['title'] = $price; + $param['body'] = $price; + $param['callback'] = "http://www.baidu.com"; + $param['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/sq_callback"; + $ret = $this->alipay($param); + redirect($ret['url']); + die; + + /* $ipa365 = new Ipa365(); + $list = $ipa365->ticketList(array( + 'token' => 'Ido9idMgbZlJHMQxjSgTHWZMB00PFEus', + 'limit' => 1, + )); + + pp($list['data']['list'][0]); */ + // 授予udid下载权限并获取下载地址 + $ret = $ipa365->udidRequest(array( + 'token' => 'Ido9idMgbZlJHMQxjSgTHWZMB00PFEus', + 'udid' => 'a8eeac3335cef5ee117d357738598f691932513b', + )); + pp($ret); + $ret = $ipa365->getinfo(array( + 'token' => 'Ido9idMgbZlJHMQxjSgTHWZMB00PFEus', + 'udid' => 'a8eeac3335cef5ee117d357738598f691932513b', + )); + pp($ret); } - + public function pay_notify_test() { - die(); - $this->pay_notify(array( - 'order_id' => 'SS_20190924102317T2jO', - 'game_id' => 1, - )); + die(); + $this->pay_notify(array( + 'order_id' => 'SS_20190924102317T2jO', + 'game_id' => 1, + )); } - + /** * 订单检查 */ public function pay_order_check() { - - $orderId = I('order_id'); - $order = M('game_supersign', 'tab_')->where(array( - 'order_id' => $orderId - ))->find(); - if (!$order) { - echo "订单不存在!"; - } - if ($order['pay_status'] == 1) { - redirect(U("Ipa365/install_show", [ - 'game_id' => $order['game_id'], - 'order_id' => $order['order_id'] - ])); - } - echo "订单正在处理中.请稍后再试!"; - exit(); + + $orderId = I('order_id'); + $order = M('game_supersign', 'tab_')->where(array( + 'order_id' => $orderId + ))->find(); + if (!$order) { + echo "订单不存在!"; + } + if ($order['pay_status'] == 1) { + redirect(U("Ipa365/install_show", [ + 'game_id' => $order['game_id'], + 'order_id' => $order['order_id'] + ])); + } + echo "订单正在处理中.请稍后再试!"; + exit(); + } + + + /** + *支付中心 + */ + public function pay(){ + $userId = $this->userinfo['user_id']; + $gameId = I("game_id", 0); + //$price = self::signprice; + if (!$userId ) { + redirect("/mobile.php/ssg/login"); + // $this->error("请登入", "/mobile.php/ssg/login"); + } + + $gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array( + 'id' => $gameId, + ))->find(); + + + $payLog = M('game_supersign', 'tab_')->where(array( + 'user_id' => $userId, + 'game_id' => $gameId + ))->find(); + + if($payLog && $payLog['pay_status']==1){ + $this->assign("error","亲~您已购买过了~
请到【订单查询】查看订单信息哟~"); + $this->display('blank'); + }else{ + if (!$gameInfo['supersign_token']) { + //$this->error("超级签token未填写!"); + $this->assign("error","超级签token未配置~"); + $this->display('blank'); + exit(); + } + + $this->assign("price", self::signprice); + //$this->assign("order_id", $orderId); + $this->assign("game_id",$gameId); + $this->assign("game_name",$gameInfo['game_name']); + $this->display('pay'); + } } + + + + /* + * 发起支付 + */ + public function dopay() { + $userId = $this->userinfo['user_id']; + if (!$userId ) { + redirect("/mobile.php/ssg/login"); + } + $gameId = I("game_id", 0); + $paytype = I("pay_type", 'ali'); + $price = self::signprice; + + if (!$userId || !$gameId) { + //$this->error("参数有误!"); + $this->assign("error","参数有误~"); + $this->display('blank'); + exit(); + } + + $payLog = M('game_supersign', 'tab_')->where(array( + 'user_id' => $userId, + 'game_id' => $gameId + ))->find(); + + $gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array( + 'id' => $gameId, + ))->find(); + + if ($payLog && $payLog['pay_status']==0) { + $orderId = $payLog['order_id']; + }elseif ($payLog && $payLog['pay_status']==1){ + /*$orderId = $payLog['order_id']; + if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){ + redirect("http://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId"); + }else{ + redirect("https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId"); + }*/ + $this->assign("error","亲~您已购买过了~
请到【订单查询】查看订单信息哟~"); + $this->display('blank'); + //$this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~"); + exit(); + } else { + $orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签 + if (!$gameInfo['supersign_token']) { + //$this->error("超级签token未填写!"); + $this->assign("error","超级签token未配置~"); + $this->display('blank'); + exit(); + } + + $r = M('game_supersign', 'tab_')->add(array( + 'udid' => '', + 'user_id' => $userId, + 'game_id' => $gameId, + 'order_id' => $orderId, + 'pay_price' => $price, + 'pay_status' => 0, + 'ticket' => '', // 调用安装的时候分配 + 'token' => $gameInfo['supersign_token'], + 'create_time' => time() + )); + if (!$r) return -1; + } + if($paytype=='ali'){ + $param['price'] = $price; + $param['sdk_version'] = '2'; + $param['user_id'] = $userId; + $param['game_id'] = $gameId; + $param['order_id'] = $orderId; + $param['apitype'] = "alipay"; + $param['config'] = "alipay"; + $param['signtype']= "MD5"; + $param['server'] = "alipay.wap.create.direct.pay.by.user"; + $param['payway'] = 1; + $param['title'] = $price; + $param['body'] = $price; + //$param['callback'] = "https://m.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; + //$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay"; + if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){ + $param['callback'] = "http://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; + $param['notifyurl'] = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay"; + }else{ + $param['callback'] = "https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; + $param['notifyurl'] = "https://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay"; + } + + $ali_pay = $this->alipay($param); + redirect($ali_pay['url']); + }else{ + $weixn = new Weixin(); + $wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true); + if($wx_pay['status']==1){ + redirect($wx_pay['mweb_url']); + }else{ + $this->assign("error",$wx_pay['return_msg']); + $this->display('blank'); + } + } + } + + /* * 发起支付 */ - public function pay() { - $userId = $this->userinfo['user_id']; - if (!$userId ) { - $this->error("请登入", "/mobile.php/ssg/login"); - } - - $gameId = I("game_id", 0); - $price = self::signprice; - - if (!$userId || !$gameId) { - $this->error("参数有误!"); - } - - $payLog = M('game_supersign', 'tab_')->where(array( - 'user_id' => $userId, - 'game_id' => $gameId - ))->find(); + public function pay1() { + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + $gameId = I("game_id", 0); + $price = self::signprice; + + if (!$userId || !$gameId) { + $this->error("参数有误!"); + } + + $payLog = M('game_supersign', 'tab_')->where(array( + 'user_id' => $userId, + 'game_id' => $gameId + ))->find(); $gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array( 'id' => $gameId, ))->find(); - if ($payLog && $payLog['pay_status']==0) { - $orderId = $payLog['order_id']; - }elseif ($payLog && $payLog['pay_status']==1){ + if ($payLog && $payLog['pay_status']==0) { + $orderId = $payLog['order_id']; + }elseif ($payLog && $payLog['pay_status']==1){ $orderId = $payLog['order_id']; if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){ redirect("http://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId"); }else{ redirect("https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId"); } - $this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~"); + $this->error("亲~您已购买过了~
请到【订单查询】查看订单信息哟~"); } else { - $orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签 - if (!$gameInfo['supersign_token']) { - $this->error("超级签token未填写!"); - } - - $r = M('game_supersign', 'tab_')->add(array( - 'udid' => '', - 'user_id' => $userId, - 'game_id' => $gameId, - 'order_id' => $orderId, - 'pay_price' => $price, - 'pay_status' => 0, - 'ticket' => '', // 调用安装的时候分配 - 'token' => $gameInfo['supersign_token'], - 'create_time' => time() - )); - if (!$r) return -1; - } - - $param['price'] = $price; - $param['sdk_version'] = '2'; - $param['user_id'] = $userId; - $param['game_id'] = $gameId; - $param['order_id'] = $orderId; - $param['apitype'] = "alipay"; - $param['config'] = "alipay"; - $param['signtype']= "MD5"; - $param['server'] = "alipay.wap.create.direct.pay.by.user"; - $param['payway'] = 1; - $param['title'] = $price; - $param['body'] = $price; - //$param['callback'] = "https://m.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; - //$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay"; + $orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签 + if (!$gameInfo['supersign_token']) { + $this->error("超级签token未填写!"); + } + + $r = M('game_supersign', 'tab_')->add(array( + 'udid' => '', + 'user_id' => $userId, + 'game_id' => $gameId, + 'order_id' => $orderId, + 'pay_price' => $price, + 'pay_status' => 0, + 'ticket' => '', // 调用安装的时候分配 + 'token' => $gameInfo['supersign_token'], + 'create_time' => time() + )); + if (!$r) return -1; + } + + $param['price'] = $price; + $param['sdk_version'] = '2'; + $param['user_id'] = $userId; + $param['game_id'] = $gameId; + $param['order_id'] = $orderId; + $param['apitype'] = "alipay"; + $param['config'] = "alipay"; + $param['signtype']= "MD5"; + $param['server'] = "alipay.wap.create.direct.pay.by.user"; + $param['payway'] = 1; + $param['title'] = $price; + $param['body'] = $price; + //$param['callback'] = "https://m.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; + //$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay"; if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){ $param['callback'] = "http://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; $param['notifyurl'] = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay"; @@ -177,65 +322,65 @@ class Ipa365Controller extends BaseController{ $param['notifyurl'] = "https://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay"; } - $ret = $this->alipay($param); + $ret = $this->alipay($param); $this->assign("url", $ret['url']); $weixn = new Weixin(); $wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true); $this->assign("wxurl", $wx_pay['mweb_url']); - $this->assign("price", self::signprice); - $this->assign("order_id", $orderId); - $this->assign("game_name",$gameInfo['game_name']); - $this->assign("callback",$param['callback']); + $this->assign("price", self::signprice); + //$this->assign("order_id", $orderId); + $this->assign("game_name",$gameInfo['game_name']); + $this->assign("callback",$param['callback']); - $this->display(); + $this->display(); } - - - // 微信分享页面 + + + // 微信分享页面 public function paytip(){ - $userId = $this->userinfo['user_id']; - if (!$userId ) { - $this->error("请登入", "/mobile.php/ssg/login"); - } - - $orderId = I('order_id'); - - $payLog = M('game_supersign', 'tab_')->where(array( - 'order_id' => $orderId, - ))->find(); - - $this->assign('url', U('Ipa365/install', array( - 'order_id' => $payLog['order_id'], - 'user_id' => $payLog['user_id'], - 'game_id' => $payLog['game_id'], - ))); - - $price = $payLog['pay_price']; - $userId = $payLog['user_id']; - $gameId = $payLog['game_id']; - - $param['price'] = $price; - $param['sdk_version'] = '2'; - $param['user_id'] = $userId; - $param['game_id'] = $gameId; - $param['order_id'] = $orderId; - $param['apitype'] = "alipay"; - $param['config'] = "alipay"; - $param['signtype']= "MD5"; - $param['server'] = "alipay.wap.create.direct.pay.by.user"; - $param['payway'] = 1; - $param['title'] = $price; - $param['body'] = $price; - //$param['callback'] = "https://m.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; - //$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay"; + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + + $orderId = I('order_id'); + + $payLog = M('game_supersign', 'tab_')->where(array( + 'order_id' => $orderId, + ))->find(); + + $this->assign('url', U('Ipa365/install', array( + 'order_id' => $payLog['order_id'], + 'user_id' => $payLog['user_id'], + 'game_id' => $payLog['game_id'], + ))); + + $price = $payLog['pay_price']; + $userId = $payLog['user_id']; + $gameId = $payLog['game_id']; + + $param['price'] = $price; + $param['sdk_version'] = '2'; + $param['user_id'] = $userId; + $param['game_id'] = $gameId; + $param['order_id'] = $orderId; + $param['apitype'] = "alipay"; + $param['config'] = "alipay"; + $param['signtype']= "MD5"; + $param['server'] = "alipay.wap.create.direct.pay.by.user"; + $param['payway'] = 1; + $param['title'] = $price; + $param['body'] = $price; + //$param['callback'] = "https://m.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; + //$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay"; $param['callback'] = "https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; $param['notifyurl'] = "https://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay"; - - $ret = $this->alipay($param); - $this->assign("url", $ret['url']); + + $ret = $this->alipay($param); + $this->assign("url", $ret['url']); $weixn = new Weixin(); $wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true); @@ -252,200 +397,200 @@ class Ipa365Controller extends BaseController{ * 下载页面 判断订单是否支付成功 */ public function install_show() { - $orderId = I('order_id', 0); - $gameId = I('game_id', 0); - /* $userId = I('user_id', 0); - - $user = M('user', 'tab_')->where(array( - 'id' => $userId - ))->find(); */ - $userId = $this->userinfo['user_id']; - if (!$userId ) { - $this->error("请登入", "/mobile.php/ssg/login"); - } - + $orderId = I('order_id', 0); + $gameId = I('game_id', 0); + /* $userId = I('user_id', 0); + + $user = M('user', 'tab_')->where(array( + 'id' => $userId + ))->find(); */ + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + // $userId = $_SESSION['user_id']; - if (!$userId ) { - $this->error("请登入", "/mobile.php/ssg/login"); - } - if (!$orderId || !$gameId || !$userId) { - $this->error("参数校验失败,请重试"); - } - - $supersign = M('game_supersign', 'tab_')->where(array('order_id' => $orderId,"game_id"=>$gameId))->find(); - if (!$supersign) { - $this->error("订单不存在"); - } - if ($supersign['pay_status'] != 1) { - $this->error("订单未支付"); - } - $game = M('game', 'tab_')->where(array('id' => $gameId))->find(); - - $this->assign('game', $game); - $this->assign('url', U('Ipa365/install', array( - 'order_id' => $orderId, - 'user_id' => $userId, - 'game_id' => $gameId - ))); - //获取礼包码 - $giftbag = M('giftbag', 'tab_')->field("*")->where(array("game_id"=>$gameId,"giftbag_version"=>3))->find(); - if(empty($giftbag)){ - $giftbag = false; - }else{ - $desribe = $giftbag['desribe']; - $mygif = $this->checkAccountGiftExist($userId,$giftbag['id']); - if(!empty($mygif)){ - //已经领取 - $giftbag =$mygif; - }else{ - if($giftbag['novice_num']>0){ - //领取 - $giftbag = $this->getNovice($userId,$this->userinfo['account'],$giftbag['id']); - } - } - $giftbag['desribe'] = $desribe; - - } - //验证是否领取 - $this->assign('giftbag', $giftbag); - $this->display(); + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + if (!$orderId || !$gameId || !$userId) { + $this->error("参数校验失败,请重试"); + } + + $supersign = M('game_supersign', 'tab_')->where(array('order_id' => $orderId,"game_id"=>$gameId))->find(); + if (!$supersign) { + $this->error("订单不存在"); + } + if ($supersign['pay_status'] != 1) { + $this->error("订单未支付"); + } + $game = M('game', 'tab_')->where(array('id' => $gameId))->find(); + + $this->assign('game', $game); + $this->assign('url', U('Ipa365/install', array( + 'order_id' => $orderId, + 'user_id' => $userId, + 'game_id' => $gameId + ))); + //获取礼包码 + $giftbag = M('giftbag', 'tab_')->field("*")->where(array("game_id"=>$gameId,"giftbag_version"=>3))->find(); + if(empty($giftbag)){ + $giftbag = false; + }else{ + $desribe = $giftbag['desribe']; + $mygif = $this->checkAccountGiftExist($userId,$giftbag['id']); + if(!empty($mygif)){ + //已经领取 + $giftbag =$mygif; + }else{ + if($giftbag['novice_num']>0){ + //领取 + $giftbag = $this->getNovice($userId,$this->userinfo['account'],$giftbag['id']); + } + } + $giftbag['desribe'] = $desribe; + + } + //验证是否领取 + $this->assign('giftbag', $giftbag); + $this->display(); } /** * 获取用户安装历史url */ public function get_install_list() { - /* $gameId = I('game_id', 0); - $where = array( - 'pay_status' => 1, - 'ticket' => array('neq', '') - ); - if ($id) $where['game_id'] = $gameId; - - $list = M('game_supersign', 'tab_')->where($where)->select(); + /* $gameId = I('game_id', 0); + $where = array( + 'pay_status' => 1, + 'ticket' => array('neq', '') + ); + if ($id) $where['game_id'] = $gameId; + + $list = M('game_supersign', 'tab_')->where($where)->select(); // pp($list); - $url = $game['supersign_url']."?code={$code}"; - pp($url); - redirect($url); */ + $url = $game['supersign_url']."?code={$code}"; + pp($url); + redirect($url); */ } - + /** * 用户点击安装 */ public function install() { - $userId = $this->userinfo['user_id']; - if (!$userId ) { - $this->error("请登入", "/mobile.php/ssg/login"); - } - - $gameId = I('game_id', 0); - $orderId = I('order_id', 0); - if (!$userId || !$gameId || !$orderId) { - $this->error("参数有误!"); - } - M()->startTrans(); - // 获取支付记录 - $gamesign = M('game_supersign', 'tab_')->where(array( - 'order_id' => $orderId, - 'user_id' => $userId, - 'game_id' => $gameId, - 'pay_status' => 1, - ))->find(); - if (!$gamesign) { - // pp(M('game_supersign', 'tab_')->_sql()); - $this->error("支付记录不存在"); - } - if ($gamesign['url']) { - redirect($gamesign['url']); - } - - $token = $gamesign['token']; - $ipa365 = new Ipa365(); - - $i = 1; - while (1) { - // 获取授权码 - $list = $ipa365->ticketList(array( - 'token' => $token, - 'limit' => $i, - )); // @todo: 并发授权码已分配的情况 - $code = $list['data']['list'][$i-1]['code']; - $codeExists = M('game_supersign', 'tab_')->field('id')->where(array( - 'ticket' => $code, - ))->find(); - if (!$codeExists) { - break; - } - - $i ++; - } - - $game = M('game', 'tab_')->where(array( - 'id' => $gameId, - ))->find(); - $url = $game['supersign_url']."?code={$code}"; - $r = M('game_supersign', 'tab_')->where(array( - 'user_id' => $userId, - 'game_id' => $gameId, - 'pay_status' => 1 - ))->save(array( - 'ticket' => $code, // 调用安装的时候分配 - 'url' => $url, - )); - if (!$r) { - pp(M('game_supersign', 'tab_')->_sql()); - M()->rollback(); - return -1; - } - M()->commit(); - // 调用第三方连接 + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + + $gameId = I('game_id', 0); + $orderId = I('order_id', 0); + if (!$userId || !$gameId || !$orderId) { + $this->error("参数有误!"); + } + M()->startTrans(); + // 获取支付记录 + $gamesign = M('game_supersign', 'tab_')->where(array( + 'order_id' => $orderId, + 'user_id' => $userId, + 'game_id' => $gameId, + 'pay_status' => 1, + ))->find(); + if (!$gamesign) { + // pp(M('game_supersign', 'tab_')->_sql()); + $this->error("支付记录不存在"); + } + if ($gamesign['url']) { + redirect($gamesign['url']); + } + + $token = $gamesign['token']; + $ipa365 = new Ipa365(); + + $i = 1; + while (1) { + // 获取授权码 + $list = $ipa365->ticketList(array( + 'token' => $token, + 'limit' => $i, + )); // @todo: 并发授权码已分配的情况 + $code = $list['data']['list'][$i-1]['code']; + $codeExists = M('game_supersign', 'tab_')->field('id')->where(array( + 'ticket' => $code, + ))->find(); + if (!$codeExists) { + break; + } + + $i ++; + } + + $game = M('game', 'tab_')->where(array( + 'id' => $gameId, + ))->find(); + $url = $game['supersign_url']."?code={$code}"; + $r = M('game_supersign', 'tab_')->where(array( + 'user_id' => $userId, + 'game_id' => $gameId, + 'pay_status' => 1 + ))->save(array( + 'ticket' => $code, // 调用安装的时候分配 + 'url' => $url, + )); + if (!$r) { + pp(M('game_supersign', 'tab_')->_sql()); + M()->rollback(); + return -1; + } + M()->commit(); + // 调用第三方连接 // pp($url); - redirect($url); + redirect($url); } - + /* * 打包列表 */ - public function pay_list() { - $userId = $this->userinfo['user_id']; - if (!$userId ) { - $this->error("请登入", "/mobile.php/ssg/login"); - } - - $list = M('game_supersion', 'tab_')->where(array( - 'user_id' => $userId, - ))->select(); - - $this->assign("list", $list); - $this->display(); - } - - // alipay - public function alipay($param) { - $pay = new \Think\Pay($param['apitype'],C($param['config'])); - $vo = new \Think\Pay\PayVo(); - $vo->setBody("超级签消费") - ->setFee($param['price'])//支付金额 - ->setTitle($param['title']) - ->setOrderNo($param['order_id']) - ->setService($param['server']) - ->setSignType($param['signtype']) - ->setPayMethod("wap") - ->setTable("supersign") - ->setPayWay($param['payway']) - ->setCallback($param['callback']) - ->setNotifyUrl($param['notifyurl']) - ->setGameName(get_game_name($param['game_id'])) - ->setServerId(0) - ->setUserId($param['user_id']) - ->setSdkVersion($param['sdk_version']); - $pay_['url']= $pay->buildRequestForm($vo); - //$pay_['out_trade_no']= $out_trade_no; - return $pay_; - - } - //领取礼包码 - public function getNovice($user_id,$account,$gift_id){ + public function pay_list() { + $userId = $this->userinfo['user_id']; + if (!$userId ) { + $this->error("请登入", "/mobile.php/ssg/login"); + } + + $list = M('game_supersion', 'tab_')->where(array( + 'user_id' => $userId, + ))->select(); + + $this->assign("list", $list); + $this->display(); + } + + // alipay + public function alipay($param) { + $pay = new \Think\Pay($param['apitype'],C($param['config'])); + $vo = new \Think\Pay\PayVo(); + $vo->setBody("超级签消费") + ->setFee($param['price'])//支付金额 + ->setTitle($param['title']) + ->setOrderNo($param['order_id']) + ->setService($param['server']) + ->setSignType($param['signtype']) + ->setPayMethod("wap") + ->setTable("supersign") + ->setPayWay($param['payway']) + ->setCallback($param['callback']) + ->setNotifyUrl($param['notifyurl']) + ->setGameName(get_game_name($param['game_id'])) + ->setServerId(0) + ->setUserId($param['user_id']) + ->setSdkVersion($param['sdk_version']); + $pay_['url']= $pay->buildRequestForm($vo); + //$pay_['out_trade_no']= $out_trade_no; + return $pay_; + + } + //领取礼包码 + public function getNovice($user_id,$account,$gift_id){ $data =M("giftbag",'tab_')->find($gift_id); $novice_str = $data['novice']; $novice_arr = str2arr($novice_str,","); @@ -483,8 +628,8 @@ class Ipa365Controller extends BaseController{ M("giftbag",'tab_')->commit(); return $record; } - } - public function checkAccountGiftExist($user_id,$gift_id){ + } + public function checkAccountGiftExist($user_id,$gift_id){ $map['user_id'] = $user_id; $map['gift_id'] = $gift_id; return M("gift_record",'tab_')->field('*')->where($map)->find(); diff --git a/Application/Sdk/View/default/Ipa365/blank.html b/Application/Sdk/View/default/Ipa365/blank.html new file mode 100644 index 000000000..86f61fc06 --- /dev/null +++ b/Application/Sdk/View/default/Ipa365/blank.html @@ -0,0 +1,34 @@ + + + + + + 错误信息 + + + +
+
+ +
错误信息
+
+
+ +
+ +
+

{$error}

+ +
+ + + + + + + \ No newline at end of file diff --git a/Application/Sdk/View/default/Ipa365/pay.html b/Application/Sdk/View/default/Ipa365/pay.html index fa8d15f40..f59dd78de 100644 --- a/Application/Sdk/View/default/Ipa365/pay.html +++ b/Application/Sdk/View/default/Ipa365/pay.html @@ -64,7 +64,7 @@ body{
请选择付款方式:
  • - 支付宝 @@ -115,7 +115,7 @@ body{ {$price}
    支付宝 @@ -125,9 +125,8 @@ body{
    推荐支付宝用户使用
    -
    微信支付 @@ -137,7 +136,6 @@ body{
    推荐微信用户使用
    -