30 lines
779 B
PHP
30 lines
779 B
PHP
<?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);
|
|
}
|
|
} |