add
This commit is contained in:
30
app/api/model/InviteMoney.php
Normal file
30
app/api/model/InviteMoney.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use app\common\library\DatabaseRoute;
|
||||
use app\common\model\Common;
|
||||
use ba\Random;
|
||||
use think\facade\Db;
|
||||
use think\Model;
|
||||
|
||||
class InviteMoney extends Model
|
||||
{
|
||||
public static function selectInviteMoney($user_id)
|
||||
{
|
||||
$where = $sale = ['user_id' => $user_id];
|
||||
$db_name = DatabaseRoute::getConnection('invite_money', $sale, true);
|
||||
$db = Db::connect($db_name)->name('invite_money');
|
||||
$money = $db->where($where)->find();
|
||||
if(!$money) {
|
||||
$money = [
|
||||
'user_id' => $user_id,
|
||||
'money_sum' => 0.00,
|
||||
'money' => 0.00,
|
||||
'cash_out' => 0.00,
|
||||
];
|
||||
$db->insert($money);
|
||||
}
|
||||
return convertToCamelCase($money);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user