Commit a57d287e by 张恒

j

parent 0053450c
......@@ -56,8 +56,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="311">
<caret line="135" column="17" lean-forward="true" selection-start-line="135" selection-start-column="17" selection-end-line="135" selection-end-column="17" />
<state relative-caret-position="399">
<caret line="179" column="32" lean-forward="true" selection-start-line="179" selection-start-column="32" selection-end-line="179" selection-end-column="32" />
<folding>
<element signature="e#34#44#0#PHP" expanded="true" />
</folding>
......@@ -92,8 +92,8 @@
<file leaf-file-name="main.scss" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Public/static/css/main.scss">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="311">
<caret line="205" column="3" lean-forward="true" selection-start-line="205" selection-start-column="3" selection-end-line="205" selection-end-column="3" />
<state relative-caret-position="368">
<caret line="208" column="16" lean-forward="true" selection-start-line="208" selection-start-column="16" selection-end-line="208" selection-end-column="16" />
<folding />
</state>
</provider>
......@@ -466,12 +466,12 @@
<option name="presentableId" value="Default" />
<updated>1562502557206</updated>
<workItem from="1562502558877" duration="2926000" />
<workItem from="1562505554364" duration="5887000" />
<workItem from="1562505554364" duration="6002000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="8813000" />
<option name="totallyTimeSpent" value="8928000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="817" extended-state="6" />
......@@ -638,8 +638,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/Application/Home/Controller/IndexController.class.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="311">
<caret line="135" column="17" lean-forward="true" selection-start-line="135" selection-start-column="17" selection-end-line="135" selection-end-column="17" />
<state relative-caret-position="399">
<caret line="179" column="32" lean-forward="true" selection-start-line="179" selection-start-column="32" selection-end-line="179" selection-end-column="32" />
<folding>
<element signature="e#34#44#0#PHP" expanded="true" />
</folding>
......
......@@ -58,16 +58,16 @@ class IndexController extends Controller
$this->assign('type', $type);
$this->display();
}
public function get_random_prize($user)
{
$v = rand(0, 1000000) / 1000000;
$today_ratio = 1;
$today_ratio = 1;
if ($v > $today_ratio) {
return false;
}
$now = time();
$to = strtotime(date('Y-m-d', $now + 86400));
$req_type = array();
$type_list = array(1);
foreach ($type_list as $type) {
......@@ -104,7 +104,7 @@ class IndexController extends Controller
'user_id' => $user['id'],
'take_time' => $now,
'last_ip' => $this->getIP(),
'channel'=>$_GET['channel']
'channel' => $_GET['channel']
));
if ($result > 0) {
return $prize;
......@@ -123,66 +123,67 @@ class IndexController extends Controller
return;
}
$type = $_GET['channel'];
if($type){
$prize = M('Prize')->where(array(
'user_id' => $user['id']
))->find();
if($prize['channel']==$type){
$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;
}
$now = time();
$from = strtotime(date('Y-m-d-h:i', $now));
$prize = $this->get_random_prize($user);
if ($prize) {
$this->ajaxReturn(array(
'errcode' => 0,
'errmsg' => null,
'data' => array(
'prize' => 1,
)
));
if ($type) {
$prize = M('Prize')->where(array(
'user_id' => $user['id']
))->find();
if ($prize['channel'] == $type) {
$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;
}
$now = time();
$from = strtotime(date('Y-m-d-h:i', $now));
$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,
'time' => $from,
'data' => date('Y-m-d-h:i', $now)
)
));
}
} else {
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => null,
'data' => array(
'prize' => 0,
'time'=>$from,
'data'=>date('Y-m-d-h:i', $now)
'p'=>$_GET['channel']
)
));
}
}else{
$this->ajaxReturn(array(
'errcode' => 1,
'errmsg' => null,
'data' => array(
'prize' => 0
)
));
}
}
public function ceshi()
......
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