Compare commits
5 Commits
caa7619b31
...
248abb51c2
Author | SHA1 | Date | |
---|---|---|---|
248abb51c2 | |||
fd1de9794d | |||
578cbfa203 | |||
0c5eb38d48 | |||
c6fadb28fa |
@ -3,17 +3,15 @@
|
|||||||
namespace app\controller\admin\api\v1;
|
namespace app\controller\admin\api\v1;
|
||||||
|
|
||||||
use app\dao\UserDao;
|
use app\dao\UserDao;
|
||||||
use app\dao\UserRewardDao;
|
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use App\Utils\ApiResponse;
|
use App\Utils\ApiResponse;
|
||||||
use App\model\Admin;
|
|
||||||
use app\model\Recommend;
|
|
||||||
use app\model\User;
|
use app\model\User;
|
||||||
use app\model\UserPhone;
|
use app\model\UserPhone;
|
||||||
use app\model\UserPhoneLog;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
use hg\apidoc\annotation as Apidoc;
|
||||||
use app\model\Withdraw;
|
|
||||||
use App\Utils\Random;
|
|
||||||
use support\Db;
|
use support\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,10 +81,11 @@ class WithdrawController
|
|||||||
//是否同意转账
|
//是否同意转账
|
||||||
$type = $request->post('type');
|
$type = $request->post('type');
|
||||||
|
|
||||||
$rate = ExchangeRate::where('type', 'BDT')->get();
|
|
||||||
//计算积分
|
|
||||||
$money = $amount * 100 / $rate[0]['points'] + 300;
|
|
||||||
$Withdraw = Withdraw::where('id', $id)->first();
|
$Withdraw = Withdraw::where('id', $id)->first();
|
||||||
|
|
||||||
|
//计算积分
|
||||||
|
$money = $Withdraw->accumulated + $Withdraw->fee;
|
||||||
|
|
||||||
if($Withdraw->status != 1){
|
if($Withdraw->status != 1){
|
||||||
return ApiResponse::error(400,[],'请勿重复点击');
|
return ApiResponse::error(400,[],'请勿重复点击');
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ class UserController
|
|||||||
*/
|
*/
|
||||||
public function team_info(Request $request)
|
public function team_info(Request $request)
|
||||||
{
|
{
|
||||||
UserPhoneLogDao::getOnlineTimeByPhone6HoserUserId();
|
// UserPhoneLogDao::getOnlineTimeByPhone6HoserUserId();
|
||||||
$user_id = $request->data['id'];
|
$user_id = $request->data['id'];
|
||||||
$user = User::find($user_id);
|
$user = User::find($user_id);
|
||||||
$res = [
|
$res = [
|
||||||
|
@ -130,8 +130,8 @@ class WithdrawController
|
|||||||
return ApiResponseApp::error(null, '提现频繁请三分钟后再试');
|
return ApiResponseApp::error(null, '提现频繁请三分钟后再试');
|
||||||
}
|
}
|
||||||
//提现金额
|
//提现金额
|
||||||
$rate = ExchangeRate::where('type', 'BDT')->get();
|
$rate = ExchangeRate::where('type', 'BDT')->first();
|
||||||
$money = (int)$money_no / 100 * $rate[0]['points'];
|
$money = (int)$money_no / 100 * $rate->points;
|
||||||
|
|
||||||
$withdraw = Withdraw::create([
|
$withdraw = Withdraw::create([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
@ -140,6 +140,8 @@ class WithdrawController
|
|||||||
'createtime2' => date('Y-m-d H:i:s'),
|
'createtime2' => date('Y-m-d H:i:s'),
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'status_text' => '申请中',
|
'status_text' => '申请中',
|
||||||
|
'accumulated'=>$money_no,
|
||||||
|
'fee'=>0
|
||||||
]);
|
]);
|
||||||
//大于1000积分等待管理员审核
|
//大于1000积分等待管理员审核
|
||||||
if ($money_no >= 100000) {
|
if ($money_no >= 100000) {
|
||||||
@ -224,8 +226,7 @@ class WithdrawController
|
|||||||
if ($withdraw->status == 5) {
|
if ($withdraw->status == 5) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$rate = ExchangeRate::where('type', 'BDT')->get();
|
$money = $withdraw->accumulated + $withdraw->fee;
|
||||||
$money = $amount * 100 / $rate[0]['points'] + 300;
|
|
||||||
UserRewardDao::base($withdraw->user_id, 1, $money, '提现失败返还');
|
UserRewardDao::base($withdraw->user_id, 1, $money, '提现失败返还');
|
||||||
$withdraw->update([
|
$withdraw->update([
|
||||||
'status' => 5,
|
'status' => 5,
|
||||||
|
@ -3,17 +3,16 @@
|
|||||||
namespace app\controller\generalization\api\v1;
|
namespace app\controller\generalization\api\v1;
|
||||||
|
|
||||||
use app\dao\UserDao;
|
use app\dao\UserDao;
|
||||||
use app\dao\UserRewardDao;
|
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use App\Utils\ApiResponse;
|
use App\Utils\ApiResponse;
|
||||||
use App\model\Admin;
|
use App\model\Admin;
|
||||||
use app\model\Recommend;
|
|
||||||
use app\model\User;
|
use app\model\User;
|
||||||
use app\model\UserPhone;
|
use app\model\UserPhone;
|
||||||
use app\model\UserPhoneLog;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
use hg\apidoc\annotation as Apidoc;
|
||||||
use app\model\Withdraw;
|
|
||||||
use App\Utils\Random;
|
|
||||||
use support\Db;
|
use support\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,8 @@ use support\Model;
|
|||||||
* @property integer $status 1申请中 2 已到账 3已驳回 4等待银行打款 5支付失败
|
* @property integer $status 1申请中 2 已到账 3已驳回 4等待银行打款 5支付失败
|
||||||
* @property integer $gift_amount 赠送积分
|
* @property integer $gift_amount 赠送积分
|
||||||
* @property integer $createtime 创建时间(时间戳)
|
* @property integer $createtime 创建时间(时间戳)
|
||||||
|
* @property integer $accumulated 提现积分
|
||||||
|
* @property integer $fee 提现手续费
|
||||||
*/
|
*/
|
||||||
class Withdraw extends Model
|
class Withdraw extends Model
|
||||||
{
|
{
|
||||||
@ -38,5 +40,7 @@ class Withdraw extends Model
|
|||||||
'username',
|
'username',
|
||||||
'status_text',
|
'status_text',
|
||||||
'order_number',
|
'order_number',
|
||||||
|
'accumulated',
|
||||||
|
'fee'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ class Task2
|
|||||||
{
|
{
|
||||||
// 每小时执行一次
|
// 每小时执行一次
|
||||||
new Crontab('0 */1 * * * *', function () {
|
new Crontab('0 */1 * * * *', function () {
|
||||||
|
return;
|
||||||
$start_time = time();
|
$start_time = time();
|
||||||
Rocketgo::test_login();
|
Rocketgo::test_login();
|
||||||
//查询系统配置 是否自动删除用户
|
//查询系统配置 是否自动删除用户
|
||||||
@ -56,26 +57,34 @@ class Task2
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//在线
|
//在线
|
||||||
if ($phone->time > 3600 && $v['logged'] == 1) {
|
if ($v['logged'] == 1) {
|
||||||
// 计算超过 1 小时的积分
|
if ($phone->time > 3600) {
|
||||||
$hours = intdiv($phone->time, 3600);
|
// 计算超过 1 小时的积分
|
||||||
$score = $hours * 20;
|
$hours = intdiv($phone->time, 3600);
|
||||||
$remainingTime = $phone->time % 3600;
|
$score = $hours * 20;
|
||||||
|
$remainingTime = $phone->time % 3600;
|
||||||
// 更新用户积分和时长
|
|
||||||
$phone->score += $score;
|
// 更新用户积分和时长
|
||||||
$phone->day_score += $score;
|
$phone->score += $score;
|
||||||
$phone->time = $remainingTime;
|
$phone->day_score += $score;
|
||||||
|
$phone->time = $remainingTime;
|
||||||
// 保存用户收益到 UserReward 表
|
|
||||||
UserRewardDao::Onhookincome($phone->user_id, $score, $phone->phone);
|
// 保存用户收益到 UserReward 表
|
||||||
// 保存在线时长记录
|
UserRewardDao::Onhookincome($phone->user_id, $score, $phone->phone);
|
||||||
UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 1, $currentTimestamp);
|
// // 保存在线时长记录
|
||||||
|
// UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 1, $currentTimestamp);
|
||||||
|
// $phone->status = 1;
|
||||||
|
// $phone->time += $currentTimestamp - $phone->last_time;
|
||||||
|
// $phone->last_time = $currentTimestamp;
|
||||||
|
// $updateData[] = $phone;
|
||||||
|
}
|
||||||
$phone->status = 1;
|
$phone->status = 1;
|
||||||
$phone->time += $currentTimestamp - $phone->last_time;
|
$phone->time += $currentTimestamp - $phone->last_time;
|
||||||
$phone->last_time = $currentTimestamp;
|
$phone->last_time = $currentTimestamp;
|
||||||
|
// 保存在线时长记录
|
||||||
|
UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 0, $currentTimestamp);
|
||||||
$updateData[] = $phone;
|
$updateData[] = $phone;
|
||||||
}
|
}
|
||||||
//不在线
|
//不在线
|
||||||
|
Loading…
x
Reference in New Issue
Block a user