Commit 925e2c01 by 张恒

j

parent af0a583a
......@@ -4,6 +4,7 @@
<list default="true" id="83262c17-7030-4f8f-af17-e1cc55f76944" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Application/Home/Controller/IndexController.class.php" afterPath="$PROJECT_DIR$/Application/Home/Controller/IndexController.class.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Public/static/js/index.js" afterPath="$PROJECT_DIR$/Public/static/js/index.js" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
......@@ -46,8 +47,8 @@
<file leaf-file-name="index.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Public/static/js/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="114">
<caret line="6" column="10" lean-forward="true" selection-start-line="6" selection-start-column="10" selection-end-line="6" selection-end-column="10" />
<state relative-caret-position="358">
<caret line="53" column="0" lean-forward="true" selection-start-line="53" selection-start-column="0" selection-end-line="53" selection-end-column="0" />
<folding />
</state>
</provider>
......@@ -56,8 +57,8 @@
<file leaf-file-name="IndexController.class.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Application/Home/Controller/IndexController.class.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="175" column="36" lean-forward="true" selection-start-line="175" selection-start-column="36" selection-end-line="175" selection-end-column="36" />
<state relative-caret-position="266">
<caret line="127" column="38" lean-forward="false" selection-start-line="127" selection-start-column="38" selection-end-line="127" selection-end-column="38" />
<folding>
<element signature="e#34#44#0#PHP" expanded="true" />
</folding>
......@@ -466,12 +467,12 @@
<option name="presentableId" value="Default" />
<updated>1562502557206</updated>
<workItem from="1562502558877" duration="2926000" />
<workItem from="1562505554364" duration="6582000" />
<workItem from="1562505554364" duration="7005000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="9508000" />
<option name="totallyTimeSpent" value="9931000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="817" extended-state="6" />
......@@ -620,26 +621,26 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Public/static/js/index.js">
<entry file="file://$PROJECT_DIR$/Public/static/css/main.scss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="114">
<caret line="6" column="10" lean-forward="true" selection-start-line="6" selection-start-column="10" selection-end-line="6" selection-end-column="10" />
<state relative-caret-position="3306">
<caret line="174" column="21" lean-forward="false" selection-start-line="174" selection-start-column="21" selection-end-line="174" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Public/static/css/main.scss">
<entry file="file://$PROJECT_DIR$/Public/static/js/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3306">
<caret line="174" column="21" lean-forward="false" selection-start-line="174" selection-start-column="21" selection-end-line="174" selection-end-column="21" />
<state relative-caret-position="358">
<caret line="53" column="0" lean-forward="true" selection-start-line="53" selection-start-column="0" selection-end-line="53" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Application/Home/Controller/IndexController.class.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="175" column="36" lean-forward="true" selection-start-line="175" selection-start-column="36" selection-end-line="175" selection-end-column="36" />
<state relative-caret-position="266">
<caret line="127" column="38" lean-forward="false" selection-start-line="127" selection-start-column="38" selection-end-line="127" selection-end-column="38" />
<folding>
<element signature="e#34#44#0#PHP" expanded="true" />
</folding>
......
......@@ -122,77 +122,53 @@ class IndexController extends Controller
));
return;
}
$type = $_GET['channel'];
if ($type) {
$type_list = array(1);
foreach ($type_list as $type_two) {
$c = M('prize')->where(array(
'channel' => $_GET['channel'],
'is_get' => 1,
))->count();
if ($type_two == 1) {
if ($c) {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => null,
'data' => array(
'prize' => 0,
'i'=>1
)
));
continue;
}
}
}
$prize = M('Prize')->where(array(
'user_id' => $user['id']
))->find();
if ($prize) {
$this->ajaxReturn(array(
'errcode' => 0,
'errmsg' => null,
'data' => array(
'prize' => 1,
'type' => 1,
)
));
return;
}
$prize = $this->get_random_prize($user);
if ($prize) {
$this->ajaxReturn(array(
'errcode' => 0,
'errmsg' => null,
'data' => array(
'prize' => 1,
)
));
} else {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => null,
'data' => array(
'prize' => 0,
'channel' => $_GET['channel']
)
));
}
$prize = M('Prize')->where(array(
'user_id' => $user['id']
))->find();
if($prize[$_POST['channel']]){
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => null,
'data' => array(
'prize' => 0
)
));
return;
}
if ($prize) {
$this->ajaxReturn(array(
'errcode' => 0,
'errmsg' => null,
'data' => array(
'prize' => 1,
'type' => 1,
)
));
return;
}
$prize = $this->get_random_prize($user);
if ($prize) {
$this->ajaxReturn(array(
'errcode' => 0,
'errmsg' => null,
'data' => array(
'prize' => 1,
)
));
} else {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => null,
'data' => array(
'prize' => 0,
'p'=>$_GET['channel']
'channel' => $_GET['channel']
)
));
}
}
public function ceshi()
......
......@@ -41,7 +41,7 @@ function btnPrize() {
$.ajax({
url: '/index/tryPrize',
type: 'post',
data:'',
data:{'channel':GetQueryString('channel')},
success: function (resp) {
var rank=RandomNumBoth(0,5);
if (resp.errcode != 0) {
......@@ -65,6 +65,12 @@ function RandomNumBoth(Min, Max) {
var num = Min + Math.round(Rand * Range); //四舍五入
return num;
}
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)return unescape(r[2]);
return null;
}
window.wx && wx.ready(function () {
// wx.hideMenuItems({
// menuList: ['menuItem:share:appMessage','menuItem:share:timeline','menuItem:share:qq','menuItem:share:facebook','menuItem:share:QZone','menuItem:copyUrl','menuItem:openWithQQBrowser',''] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment