1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2019/1/19
- * Time: 10:08
- */
- namespace App\Modules\YunQi\Services;
- use App\Modules\YunQi\Models\YqUserBidRelation;
- class YqUserBidRelationService
- {
- public static function getByUidAndBid($uid,$bid){
- if(empty($uid) || empty($bid)){
- return false;
- }
- try{
- return YqUserBidRelation::where('uid',$uid)->where('from_bid',$bid)->select('id','to_bid')->first();
- }catch (\Exception $e){
- }
- return false;
- }
- public static function create($uid,$from_bid,$type,$to_bid){
- if(empty($uid) || empty($from_bid) || empty($type)){
- return false;
- }
- if(!self::getByUidAndBid($uid,$from_bid)){
- try{
- YqUserBidRelation::create([
- 'uid'=>$uid,
- 'from_bid'=>$from_bid,
- 'type'=>$type,
- 'to_bid'=>$to_bid
- ]);
- }catch (\Exception $e){
- }
- }
- return true;
- }
- }
|