Compare commits
4 Commits
eb299de411
...
377efca3cb
Author | SHA1 | Date |
---|---|---|
|
377efca3cb | |
|
6f31116422 | |
|
d85ae3931e | |
|
2e4e9a9e31 |
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace app\controller\api;
|
||||
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponseApp;
|
||||
|
||||
|
||||
use App\model\Dictionary;
|
||||
use App\model\Message;
|
||||
use App\model\ExchangeRate;
|
||||
use app\model\User;
|
||||
use app\model\UserReward;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
use support\Db;
|
||||
use support\Log;
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("?")
|
||||
*/
|
||||
|
||||
class TextController
|
||||
{
|
||||
protected $noNeedLogin = ['get_projectdetailed', 'get_projectdetailed', 'get_mechanism_list'];
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("1.0 手机号在线历史归类函数")
|
||||
* @Apidoc\Url("api/text/classifyPhoneOnlineHistory")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function classifyPhoneOnlineHistory(Request $request)
|
||||
{
|
||||
$result = Db::table('your_table') // 这里的 'your_table' 应该是你存储用户积分的表名
|
||||
->select('username', Db::raw('SUM(amount) as total_points')) // 计算每个用户名的积分总数
|
||||
->groupBy('username') // 按用户名分组
|
||||
->get();
|
||||
foreach ($result as $v) {
|
||||
$user = User::where('username', $v->username)->first();
|
||||
$user->money += $v->total_points;
|
||||
$user->save();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -132,7 +132,7 @@ class WithdrawController
|
|||
//提现金额
|
||||
$rate = ExchangeRate::where('type', 'BDT')->first();
|
||||
$money = (int)$money_no / 100 * $rate->points;
|
||||
|
||||
$userbank = Userbank::where('id', $bank_id)->first();
|
||||
$withdraw = Withdraw::create([
|
||||
'user_id' => $user_id,
|
||||
'amount' => $money,
|
||||
|
@ -141,7 +141,10 @@ class WithdrawController
|
|||
'username' => $user->username,
|
||||
'status_text' => '申请中',
|
||||
'accumulated'=>$money_no,
|
||||
'fee'=>0
|
||||
'fee'=>self::$handlingFee,
|
||||
'account'=>$userbank->account,
|
||||
'bank_name'=>$userbank->bank_name,
|
||||
'bank_username'=>$userbank->bank_username
|
||||
]);
|
||||
//大于1000积分等待管理员审核
|
||||
if ($money_no >= 100000) {
|
||||
|
@ -152,7 +155,7 @@ class WithdrawController
|
|||
|
||||
//用户积分减少$money
|
||||
UserRewardDao::base($user_id, 1, - ($money_no + self::$handlingFee), '提现');
|
||||
$userbank = Userbank::where('id', $bank_id)->first();
|
||||
|
||||
//获取刚刚存入数据库的id(订单号)
|
||||
$orderId = $withdraw->id;
|
||||
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id VIP级别的唯一标识符
|
||||
* @property integer $user_id 用户id
|
||||
|
@ -12,6 +13,9 @@ use support\Model;
|
|||
* @property integer $createtime 创建时间(时间戳)
|
||||
* @property integer $accumulated 提现积分
|
||||
* @property integer $fee 提现手续费
|
||||
* @property string $account 提现银行账户
|
||||
* @property string $bank_name 提现银行
|
||||
* @property string $bank_username 提现银行用户名
|
||||
*/
|
||||
class Withdraw extends Model
|
||||
{
|
||||
|
@ -29,18 +33,7 @@ class Withdraw extends Model
|
|||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
|
||||
|
||||
// public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'amount',
|
||||
'status',
|
||||
'createtime2',
|
||||
'username',
|
||||
'status_text',
|
||||
'order_number',
|
||||
'accumulated',
|
||||
'fee'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class Task2
|
|||
UserPhone::whereNotIn('phone', $all_usernames)
|
||||
->where('status', '!=', 2)
|
||||
->update(['status' => 2,'last_time'=>$currentTimestamp]);
|
||||
|
||||
UserPhone::where('status', 2)->update(['last_time'=>$currentTimestamp,'time'=>0]);
|
||||
// 批量查询用户信息
|
||||
$phones2 = UserPhone::whereIn('phone', $usernames2)->get();
|
||||
|
||||
|
|
Loading…
Reference in New Issue