MoneyBuyMatch.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: scstf
  5. * Date: 2018/9/28
  6. * Time: 20:05
  7. */
  8. namespace App\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class MoneyBuyMatch extends Model
  11. {
  12. protected $table='money_buy_match';
  13. public $timestamps = false;
  14. public function getByAttrs($where,$orderArray=[]){
  15. if (empty($order)){
  16. $datas = $this->where($where)->get();
  17. }else{
  18. $datas = $this->where($where)->orderby($orderArray['orderby'],$orderArray['order'])->get();
  19. }
  20. return $datas ;
  21. }
  22. //赛事下所有下注单式下单
  23. function allsimplexorder($ssid,$code){
  24. //单式下单
  25. $where = array();
  26. $where[] = array('money_buy_match.match_id', '=', $ssid);
  27. $where[] = array('money_buy_match.bet_type', '=', 1);
  28. $where[] = array('money_buy_match.game_code', '=', $code);
  29. $data = $this->join('money_buy_simplex','money_buy_match.batch_id','=','money_buy_simplex.batch_id')->select('money_buy_simplex.order_id','money_buy_simplex.money','money_buy_simplex.account_identity','money_buy_simplex.info_identity','money_buy_simplex.match_id')->where($where)->get()->toArray();
  30. return $data;
  31. }
  32. //赛事下所有下注串式下单
  33. function allstrorder($ssid){
  34. //串式下单
  35. $where = array();
  36. $where[] = array('money_buy_match.match_id', '=', $ssid);
  37. $where[] = array('money_buy_match.bet_type', '=', 2);
  38. $data = $this->join('money_buy_str','money_buy_match.batch_id','=','money_buy_str.batch_id')->select('money_buy_str.order_id')->where($where)->get()->toArray();
  39. return $data;
  40. }
  41. //修改串式下注状态
  42. function updatast($match_id){
  43. $the = array(
  44. 'updated_at'=>date('Y-m-d H:i:s'),
  45. 'result'=>2,
  46. );
  47. $where = array(
  48. 'match_id'=>$match_id,
  49. 'bet_type'=>2,
  50. );
  51. $res = $this->where($where)->update($the);
  52. if (!$res) {
  53. return -4010000102; //更新失败
  54. }
  55. return $res;
  56. }
  57. }