thinkphp

多字段自增更新inc

$res = db("currency")->where("uid = '{$res["uid"]}'")->Inc('wallet',$price)->Inc('standard',$price)->update();

wherein

  $flists = model("UserInvite")->where("uid",$v["uid"])->select();

                    $flistuid = array_column($flists, "fuid");

                    $flist = $this->model

                    ->alias("account")

                    ->with("user")

//                    ->where("user_account.name != ''")

                    ->whereIn("user_account.uid",$flistuid)

                    ->select();

getdata();

    foreach ($list as $key => $value) {

            $user = $model->field('department_id')->find($value['user_id'])->getdata();

//            dump($user);

            dump($value->getdata());die;

            foreach ($dlist as $dkey => $dvalue) {

               

                if($dvalue==$user['department_id']){

                    $list[$key]['department'] = $dvalue['title'];

                }

            }

thinkphp 6

$user = $model->field('department_id')->find($value['user_id'])->getdata();

use think\facade\Db;

model with查询

public function userOneCard()

   

    {

        return $this->belongsTo('app\\common\\model\\UserOnecard','user_id');

    }

    return $this->with(['shop','table','user_onecard'])

不同前缀表join用法

$topic = DB::table("zgcn_app_topic cir")->join(['zgcn_app_circle_follow' =>  'fol'],'cir.id = fol.circle_id')

                ->select(DB::raw('cir.id, cir.img as logo, cir.title, cir.content, cir.eye, cir.time, count(fol.id) as count'));

           

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容