| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | <?phpnamespace Journal\Lib;use Dever;class Pay{	/**	 * 支付成功后,调取的接口	 *	 * @return mixed	 */	public function act_api($param = array())	{        $send = Dever::preInput('pay_');        $key = md5('jmss_2018');        ksort($send);        $send['signature'] = md5($key . '&' . http_build_query($send));        $signature = Dever::input('signature');        if ($send['signature'] == $signature) {            $product_id = $send['pay_product_id'];            $uid = $send['pay_uid'];            $cash = $send['pay_cash'];            $order_id = $send['pay_order_id'];            $status = $send['pay_status'];            $msg = $send['pay_msg'];            $order = Dever::db('journal/order')->one(array('order_id' => $order_id, 'uid' => $uid));            if ($send['pay_status'] == 2 && $order) {                Dever::db('journal/order')->update(array('where_id' => $order['id'], 'status' => 2));                # 订阅                Dever::load('act/lib/subscribe')->submit($uid, $order['product_id'], 1);                $score = false;                $num = false;                if ($order['buy_id'] > 0) {                    $info = Dever::db('journal/info')->one($order['product_id']);                    $buy = Dever::db('journal/buy_num')->one($order['buy_id']);                    if ($info && $buy && $info['score'] > 0) {                        $score = $buy['num'] * $info['score'];                    } elseif ($info && $buy) {                        $num = $buy['num'];                    }                }                Dever::score($uid, 'buy_journal', '购买小刊', 'act/lib/score.submit?method=pay&type=4&id=' . $order['product_id'], $score, $num);                # 发消息                $journal = Dever::db('journal/info')->one($order['product_id']);                Dever::load('message/lib/data')->push(-1, $uid, '购买提醒', '购买成功,您获得了 '.$journal['name'].' 的阅读资格!', $type = 1);                # 发模板消息                /*                $send['key'] = 'pay';                $send['project_id'] = 1;                $send['touser'] = 'pay';                $send['page'] = 'page';                $send['data'] = array                (                    'keyword1' => array('value', 1),                );                $send['form_id'] = 'pay';                Dever::load('wechat_applet/msg.send', $send);                */                # 发短信            } else {                Dever::db('journal/order')->update(array('where_id' => $order['id'], 'status' => 3));            }        }	}}
 |