|
@@ -7,136 +7,6 @@ use Main\Lib\Core;
|
|
|
|
|
|
class Content extends Core
|
|
|
{
|
|
|
-
|
|
|
- public function del()
|
|
|
- {
|
|
|
- $uid = Dever::input('uid');
|
|
|
- Dever::db('passport/user')->delete($uid);
|
|
|
- $info = Dever::db('passport/wechat')->state(array('uid' => $uid));
|
|
|
- if ($info) {
|
|
|
- foreach ($info as $k => $v) {
|
|
|
- Dever::db('passport/wechat')->delete($v['id']);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return 'ok';
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
- public function score_code_actact()
|
|
|
- {
|
|
|
- $where['status'] = 2;
|
|
|
- $where['product_id'] = 15;
|
|
|
- $where['type'] = 3;
|
|
|
- $where['buy_id'] = Dever::input('buy_id', 48);
|
|
|
- $uid = Dever::input('uid');
|
|
|
- $test = Dever::input('test');
|
|
|
- if ($uid > 0) {
|
|
|
- $where['uid'] = $uid;
|
|
|
- }
|
|
|
- $id = array
|
|
|
- (
|
|
|
- 48 => 10,
|
|
|
- 49 => 100,
|
|
|
- 50 => 300,
|
|
|
- 51 => 600
|
|
|
- );
|
|
|
- $buy = Dever::db('journal/buy_num')->one($where['buy_id']);
|
|
|
- $info = Dever::db('journal/info')->one($where['product_id']);
|
|
|
- $data = Dever::db('journal/order')->state($where);
|
|
|
- $time = Dever::maketime('2019-01-29 14:44:30');
|
|
|
- if ($data) {
|
|
|
- if ($test == 1) {
|
|
|
- print_r($data);die;
|
|
|
- }
|
|
|
- foreach ($data as $k => $v) {
|
|
|
- if ($v['cdate'] < $time && isset($id[$v['buy_id']]) && $id[$v['buy_id']]) {
|
|
|
- if ($v['type'] == 3) {
|
|
|
-
|
|
|
- $w['code'] = $v['code'];
|
|
|
- $o = Dever::db('code/info')->one($w);
|
|
|
- print_r($buy);
|
|
|
- if ($o) {
|
|
|
- $up['product_num'] = $buy['num'];
|
|
|
- $up['where_id'] = $o['id'];
|
|
|
- Dever::db('code/info')->update($up);
|
|
|
- }
|
|
|
-
|
|
|
- print_r($o);
|
|
|
- print_r($v);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function score_actact()
|
|
|
- {
|
|
|
- $where['status'] = 2;
|
|
|
- $where['product_id'] = 15;
|
|
|
- $where['type'] = Dever::input('type', 1);
|
|
|
- $where['buy_id'] = Dever::input('buy_id', 48);
|
|
|
- $uid = Dever::input('uid');
|
|
|
- $test = Dever::input('test');
|
|
|
- if ($uid > 0) {
|
|
|
- $where['uid'] = $uid;
|
|
|
- }
|
|
|
- $id = array
|
|
|
- (
|
|
|
- 48 => 10,
|
|
|
- 49 => 100,
|
|
|
- 50 => 300,
|
|
|
- 51 => 600
|
|
|
- );
|
|
|
- $info = Dever::db('journal/info')->one($where['product_id']);
|
|
|
- $data = Dever::db('journal/order')->state($where);
|
|
|
- $time = Dever::maketime('2019-01-29 14:44:30');
|
|
|
- if ($data) {
|
|
|
- print_r($data);die;
|
|
|
- if ($test == 1) {
|
|
|
- print_r($data);die;
|
|
|
- }
|
|
|
- foreach ($data as $k => $v) {
|
|
|
- if ($v['uid'] != 25371 && $v['uid'] != 25555 && $v['cdate'] < $time && isset($id[$v['buy_id']]) && $id[$v['buy_id']]) {
|
|
|
- $num = $id[$v['buy_id']] - 1;
|
|
|
- $score = $num * $info['score'];
|
|
|
-
|
|
|
- $user = Dever::db('score/user')->one(array('uid' => $v['uid']));
|
|
|
- if ($user) {
|
|
|
- $update['where_id'] = $user['id'];
|
|
|
- $update['score'] = $user['score'] + $score;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $user_log = false;
|
|
|
-
|
|
|
- if (!$user_log) {
|
|
|
- if ($v['type'] == 1) {
|
|
|
- Dever::score($v['uid'], 'buy_journal', '购买小刊', 'act/lib/score.submit?method=pay&type=4&id=' . $v['product_id'], $score, false);
|
|
|
- } elseif ($v['type'] == 3) {
|
|
|
-
|
|
|
- $w['type'] = 2;
|
|
|
- $w['code'] = $v['code'];
|
|
|
- $w['status'] = 2;
|
|
|
- $o = Dever::db('journal/order')->one($w);
|
|
|
-
|
|
|
- if ($o) {
|
|
|
- Dever::score($o['uid'], 'dh_journal', '兑换小刊', 'act/lib/score.submit?method=code&type=4&id=' . $o['product_id'], $score, false);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- print_r($v);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return 'ok';
|
|
|
- }
|
|
|
-
|
|
|
public function test_redis()
|
|
|
{
|
|
|
|
|
@@ -181,40 +51,6 @@ class Content extends Core
|
|
|
echo 'ok';die;
|
|
|
}
|
|
|
|
|
|
- public function test()
|
|
|
- {
|
|
|
- $journal = Dever::db('journal/info')->one(8);
|
|
|
-
|
|
|
- $uid = Dever::input('uid');
|
|
|
- $user = Dever::db('passport/user')->one($uid);
|
|
|
- $wechat = Dever::db('passport/wechat')->one(array('uid' => $uid));
|
|
|
-
|
|
|
- print_r($wechat);die;
|
|
|
- if ($wechat && Dever::project('wechat_applet')) {
|
|
|
- $send['key'] = 'buy_journal';
|
|
|
- $send['project_id'] = 1;
|
|
|
- $send['touser'] = $wechat['openid'];
|
|
|
- $send['page'] = Dever::config('base')->applet_index . '?scene=' . Dever::login($uid) . ',' . '4,' . $order['product_id'];
|
|
|
- $send['data'] = json_encode(array
|
|
|
- (
|
|
|
- 'keyword1' => array('value' => date('Y年m月d日 H:i', $order['cdate'])),
|
|
|
- 'keyword2' => array('value' => '购买成功,您获得了 '.$journal['name'].' 的阅读资格!'),
|
|
|
- ));
|
|
|
- $send['form_id'] = Dever::load('act/lib/form')->get($uid, 2);
|
|
|
-
|
|
|
- if ($send['form_id']) {
|
|
|
- Dever::load('wechat_applet/msg.send', $send);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (isset($user['mobile']) && $user['mobile'] && Dever::project('sms')) {
|
|
|
- $send = array();
|
|
|
- $send['name'] = $journal['name'];
|
|
|
- Dever::load('sms/api.send', 'buy_journal', $user['mobile'], $send);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
public function ad()
|
|
|
{
|