当前位置: 首页>>代码示例>>PHP>>正文


PHP Contacts::findFirst方法代码示例

本文整理汇总了PHP中Contacts::findFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::findFirst方法的具体用法?PHP Contacts::findFirst怎么用?PHP Contacts::findFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contacts的用法示例。


在下文中一共展示了Contacts::findFirst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: quicksmsAction

 public function quicksmsAction()
 {
     if ($this->request->isPost() == true) {
         $this->response->setContentType('application/json');
         $contact_number = $this->request->getPost('contact_number');
         $contact_number = explode(',', $contact_number);
         $message = $this->request->getPost('message');
         $user_id = $this->request->getPost('user_id');
         $contact_ids = array();
         foreach ($contact_number as $number) {
             $con_data = Contacts::findFirst("number LIKE '%{$number}%' AND user_id={$user_id} AND deleted=0");
             if ($con_data) {
                 $contact_ids[] = $con_data->id;
                 $type = "CONTACTID";
             } else {
                 $contact_ids[] = $number;
                 $type = "NUMBER";
             }
         }
         $data = $this->sendSmsProcessData(array('message' => $message, 'user_id' => $user_id, 'ids' => $contact_ids, 'type' => $type, 'contacts' => $contact_ids));
         $this->response->setContent(json_encode($data));
         $this->response->send();
     }
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:24,代码来源:SmsController.php

示例2: updateContact

 private function updateContact($contact_data)
 {
     $number = $contact_data['number'];
     $user_id = $contact_data['user_id'];
     $contact = Contacts::findFirst("user_id={$user_id} AND number LIKE '%{$number}%'");
     if ($contact->deleted == 1) {
         $contact->name = $contact_data['contact_name'];
         $contact->address = $contact_data['address'];
         $contact->email = $contact_data['email'];
         $contact->deleted = 0;
         $contact->save();
         $data = array('status' => 'success', 'msg' => $contact_data['msg'], 'code' => 2);
     } else {
         $data = array('status' => 'error', 'msg' => 'Already Exist', 'code' => 1);
     }
     return $data;
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:17,代码来源:UserController.php

示例3: getNumbers

 public static function getNumbers($contact_ids)
 {
     $numbers = array();
     foreach ($contact_ids as $contact_id) {
         $result = Contacts::findFirst("id= '{$contact_id}'");
         $numbers[] = $result->number;
     }
     return implode(',', $numbers);
 }
开发者ID:adeshhashbyte,项目名称:smhawkapi,代码行数:9,代码来源:Contacts.php


注:本文中的Contacts::findFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。