|
@@ -61,6 +61,22 @@ class Info extends Base
|
|
|
$info = Dever::db('task/info')->one($id);
|
|
|
# 检测用户是否登录,是否认证,仅显示认证信息
|
|
|
|
|
|
+ $report_id = Dever::input('report_id', -1);
|
|
|
+
|
|
|
+ if ($report_id) {
|
|
|
+ $info['report'] = Dever::db('task/user_report')->one($report_id);
|
|
|
+ }
|
|
|
+ if (!$info['report']) {
|
|
|
+ $info['report'] = array
|
|
|
+ (
|
|
|
+ 'id' => -1,
|
|
|
+ 'username' => '',
|
|
|
+ 'pic' => '',
|
|
|
+ 'link' => '',
|
|
|
+ 'desc' => '',
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $info['report']['submit'] = $this->url('task/report.submit', array('id' => $info['id'], 'report_id' => $report_id));
|
|
|
$this->getOne($info, $button = true);
|
|
|
}
|
|
|
|
|
@@ -80,6 +96,7 @@ class Info extends Base
|
|
|
$id = Dever::input('id');
|
|
|
$info = array();
|
|
|
if ($id > 0) {
|
|
|
+ $this->data['cate'] = Dever::db('task/cate')->state();
|
|
|
$info = Dever::db('task/info')->one($id);
|
|
|
$this->getOne($info, $button = true);
|
|
|
|
|
@@ -113,7 +130,7 @@ class Info extends Base
|
|
|
$insert['level_id'] = $info['level_id'];
|
|
|
$insert['status'] = 1;
|
|
|
$info['user_task'] = Dever::db('task/user_task')->insert($insert);
|
|
|
- return $info;
|
|
|
+ return '领取成功';
|
|
|
} else {
|
|
|
Dever::alert('领取失败');
|
|
|
}
|
|
@@ -220,7 +237,7 @@ class Info extends Base
|
|
|
} elseif ($data['user_num'] >= $data['num']) {
|
|
|
# 抢光了
|
|
|
$button = 3;
|
|
|
- } elseif (isset($this->data['uid']) && $this->data['uid'] > 0) {
|
|
|
+ } elseif (isset($this->data['uid']) && $this->data['uid']) {
|
|
|
# 判断等级
|
|
|
$level = Dever::db('task/level')->one($data['level_id']);
|
|
|
if ($level && isset($this->data['user_score']) && $this->data['user_score'] && $level['score'] > $this->data['user_score']['score']) {
|
|
@@ -260,28 +277,37 @@ class Info extends Base
|
|
|
);
|
|
|
|
|
|
$result['status'] = $button;
|
|
|
+ $result['name'] = '领取任务';
|
|
|
$result['desc'] = $config[$button];
|
|
|
$result['icon'] = '';
|
|
|
- $result['class'] = 'button';
|
|
|
+ $result['class'] = 'button dever_task_submit';
|
|
|
$result['link'] = 'javascript:;';
|
|
|
+ $result['submit'] = '';
|
|
|
+
|
|
|
+ $result['report_link'] = Dever::url('task/submit?id=' . $data['id'] . '&nonce=' . Dever::id(), 'main');
|
|
|
+
|
|
|
+ if ($result['status'] == 5) {
|
|
|
+ $result['name'] = '提交报告';
|
|
|
+ $result['link'] = $result['report_link'];
|
|
|
+ $result['class'] = 'button';
|
|
|
+ $result['desc'] = '<p>' . $result['desc'] . '</p>';
|
|
|
|
|
|
- if ($result['status'] > 1) {
|
|
|
+ } elseif ($result['status'] > 1) {
|
|
|
+ if ($result['status'] == 3) {
|
|
|
+ $result['name'] = '抢光了';
|
|
|
+ }
|
|
|
$result['class'] = 'button disable';
|
|
|
$result['desc'] = '<p>' . $result['desc'] . '</p>';
|
|
|
} else {
|
|
|
- $result['link'] = 'javascript:submit();';
|
|
|
$result['icon'] = 'ico-coin';
|
|
|
$result['desc'] = '<p>任务奖励' . $data['score'] . $this->data['config']['score_name'] . '<span>/' . $this->data['config']['report_name'] . '</span></p><p>组员贡献' . $data['group_score'] . $this->data['config']['score_name'] . '<span>/' . $this->data['config']['report_name'] . '</span></p>';
|
|
|
+ $result['submit'] = $this->url('task/info.submit', array('id' => $data['id']));
|
|
|
}
|
|
|
|
|
|
if ($result['icon']) {
|
|
|
$result['desc'] = '<em class="'.$result['icon'].'"></em><section>'.$result['desc'].'</section>';
|
|
|
}
|
|
|
|
|
|
- if ($result['status'] == 5) {
|
|
|
- $result['link'] = Dever::url('task/submit', 'main');
|
|
|
- }
|
|
|
-
|
|
|
return $result;
|
|
|
}
|
|
|
}
|