MoneyBuyMatch.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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){
  24. //单式下单
  25. $where = array();
  26. $where[] = array('money_buy_match.match_id', '=', $ssid);
  27. $where[] = array('money_buy_match.bet_type', '=', 1);
  28. $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();
  29. return $data;
  30. }
  31. //赛事下所有下注串式下单
  32. function allstrorder($ssid){
  33. //串式下单
  34. $where = array();
  35. $where[] = array('money_buy_match.match_id', '=', $ssid);
  36. $where[] = array('money_buy_match.bet_type', '=', 2);
  37. $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();
  38. return $data;
  39. }
  40. //修改串式下注状态
  41. function updatast($match_id){
  42. $the = array(
  43. 'updated_at'=>date('Y-m-d H:i:s'),
  44. 'result'=>2,
  45. );
  46. $where = array(
  47. 'match_id'=>$match_id,
  48. 'bet_type'=>2,
  49. );
  50. $res = $this->where($where)->update($the);
  51. if (!$res) {
  52. return -4010000102; //更新失败
  53. }
  54. return $res;
  55. }
  56. }