123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace Code\Lib;
- use Dever;
- class Manage
- {
- /**
- * 显示用户信息
- *
- * @return mixed
- */
- public function showUserInfo($uid, $ldate = false)
- {
- if ($uid) {
- $user = Dever::db('passport/user')->one($uid);
- if ($user) {
- $table = array();
- $table['用户名'] = $user['username'];
- $table['手机号'] = $user['mobile'];
- $table['领取时间'] = date('Y-m-d H:i:s', $ldate);
- return Dever::table($table);
- }
- } else {
- return '';
- }
- }
- /**
- * 创建兑换码
- *
- * @return mixed
- */
- public function create($id, $name, $data)
- {
- $code = Dever::param('code', $data);
- $type = Dever::param('type', $data);
- $product_id = Dever::param('product_id', $data);
- $product_id = $id;
- if (!in_array(2, $type)) {
- return;
- }
- $total = Dever::db('code/info')->total(array('product_id' => $product_id,'product_price_id' => $id, 'type' => 1));
- if ($code > 0 && $code > $total) {
- $num = $code - $total;
- for ($i = 0; $i < $num; $i++) {
- $this->createCode($product_id, $id);
- }
- }
- }
- private function createCode($product_id, $id)
- {
- $code = Dever::rand(8, 0);
- $data['product_id'] = $product_id;
- $data['product_price_id'] = $id;
- $data['code'] = $code;
- $total = Dever::db('code/info')->total($data);
- if ($total > 0) {
- return $this->createCode($product_id, $id);
- }
- $data['type'] = 1;
- Dever::db('code/info')->insert($data);
- return $code;
- }
- /**
- * 资料审核
- *
- * @return mixed
- */
- public function info_audit($id, $name, $data)
- {
- $info = Dever::db('task/user_info')->one($id);
- $status = Dever::param('status', $data);
- $desc = Dever::param('status_desc', $data);
- if ($info && $status == 3) {
- $uid = $info['uid'];
- $name = '用户认证未通过';
- $content = '原因:' . $desc;
- Dever::load('message/lib/data.push', -1, $uid, $name, $content, 11);
- }
- }
- }
|