$MallUser = Db::table('ea_mall_user');
if ($MallUser->where("open_id='$openId'")->count() == 1)
{
$data['msg'] = 'exist user';
echo json_encode($data);
return;
}
$maxUserId = $MallUser ->max('user_id'); //竟然取到了上一个->count()的结果总是0
if ($maxUserId < 10) {
// $maxUserId = '100000';
}
===========================================
所以需要每次都这样
$MallUser = Db::table('ea_mall_user');
if ($MallUser->where("open_id='$openId'")->count() == 1)
{
$data['msg'] = 'exist user';
echo json_encode($data);
return;
}
$maxUserId = Db::table('ea_mall_user')->max('user_id');
if ($maxUserId < 10) {
// $maxUserId = '100000';
}