one($id);
$user = Dever::load("passport/user-one", $info['uid']);
$table['用户名'] = $user['username'];
$table['手机号'] = $user['mobile'];
if ($info['pic']) {
$table['图片'] = '';
}
if ($info['content']) {
$table['内容'] = $info['content'];
}
return Dever::table($table);
}
public function showOrderUser($id)
{
$info = Dever::db('user/ticket_order')->one($id);
$table = array();
$user = Dever::db('passport/user')->one($info['uid']);
$table['用户名'] = $user['username'] . '('.$info['uid'].')';
$table['手机号'] = $user['mobile'];
$table['产品名'] = $info['name'];
//$table['购买数量'] = $info['num'];
if ($info['parent_uid'] && $info['parent_uid'] != $info['uid']) {
$user = Dever::db('passport/user')->one($info['parent_uid']);
$table['邀请人'] = $user['username'];
}
return Dever::table($table);
}
public function showSeatOrderUser($id)
{
$info = Dever::db('user/seat_order')->one($id);
$table = array();
$user = Dever::db('passport/user')->one($info['uid']);
$table['用户名'] = $user['username'] . '('.$info['uid'].')';
$table['手机号'] = $user['mobile'];
$table['产品名'] = $info['name'];
//$table['购买数量'] = $info['num'];
if ($info['parent_uid'] && $info['parent_uid'] != $info['uid']) {
$user = Dever::db('passport/user')->one($info['parent_uid']);
$table['邀请人'] = $user['username'];
}
return Dever::table($table);
}
public function showOrderStatus($id, $type)
{
$info = Dever::db('user/'.$type.'_order')->one($id);
if ($info) {
if ($info['status'] == 1) {
#return '*已支付';
return '待支付';
} elseif ($info['status'] == 2) {
return '已支付';
} elseif ($info['status'] == 3) {
return '支付失败';
} elseif ($info['status'] == 5) {
$table['状态'] = '已退款';
$manage = Dever::db('manage/admin')->one($info['tk_admin']);
$table['备注'] = $info['tk_desc'];
$table['截图'] = '';
//$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
$table['操作人'] = $manage['username'];
return Dever::table($table);
}
}
}
# 退款操作
public function refund($id, $name, $data)
{
$status = Dever::param('status', $data);
if ($status == 5 && $id > 0) {
$send = array();
$info = Dever::db('act/order')->one($id);
if ($info['system'] == 1) {
if ($info['cate_id'] == 1) {
$account_id = 1;
}
if ($info['cate_id'] == 2) {
$account_id = 4;
}
if ($info['cate_id'] == 3) {
$account_id = 5;
}
} elseif ($info['system'] == 2) {
$account_id = 2;
if ($info['cate_id'] == 2) {
$account_id = 7;
}
} else {
$account_id = 3;
}
$send['pay_project_id'] = 3;
$send['pay_uid'] = $info['uid'];
$send['pay_order_id'] = $info['order_id'] ? $info['order_id'] : Dever::load('act/order')->createOrderId($info, $info['id']);
$send['pay_tk_pic'] = Dever::param('tk_pic', $data);
$send['pay_tk_time'] = Dever::param('tk_time', $data);
$send['pay_tk_desc'] = Dever::param('tk_desc', $data);
$send['pay_account_id'] = $account_id;
$send['pay_cash'] = $info['cash'];
$send['pay_status'] = $status;
$send['dever_token'] = $this->key;
Dever::load('pay/lib/set.updateStatus', $send);
if ($info['buy_id'] > 0) {
$buy = Dever::db('journal/buy_num')->one($info['buy_id']);
if ($buy) {
if ($info['buy_num'] > 0) {
$num = $info['buy_num'];
} else {
$num = $buy['num'];
}
# 减少积分
$score = $num * 20;
$user = Dever::db('score/user')->one(array('uid' => $info['uid']));
if ($user) {
$user_id = $user['id'];
$user_score = $user['score'];
$user_score = $user_score - $score;
if ($user_score < 0) {
$user_score = 0;
}
Dever::db('score/user')->update(array('where_id' => $user_id, 'score' => $user_score));
}
# 减少排行榜
$journal_num = Dever::db('act/journal_num')->one(array('uid' => $info['uid'], 'journal_id' => $info['product_id']));
if ($journal_num) {
$journal_num_id = $journal_num['id'];
$journal_num = $journal_num['num'];
$journal_num = $journal_num - $num;
if ($journal_num < 0) {
$journal_num = 0;
}
Dever::db('act/journal_num')->update(array('where_id' => $journal_num_id, 'num' => $journal_num));
}
# 减少订阅本数 这个定时跑就行了 不管了
$journal = Dever::db('journal/info')->one($info['product_id']);
if ($journal) {
$journal_id = $journal['id'];
$journal_num = $journal['num_ding'];
$journal_num = $journal_num - $num;
if ($journal_num < 0) {
$journal_num = 0;
}
Dever::db('journal/info')->update(array('where_id' => $journal_id, 'num_ding' => $journal_num));
}
}
}
}
return 'reload';
}
}