本文整理汇总了PHP中Utility::AssColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Utility::AssColumn方法的具体用法?PHP Utility::AssColumn怎么用?PHP Utility::AssColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility::AssColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sync_event_users
function sync_event_users()
{
$current_users = OutboundUsers::GetPartnerUsers(1);
$current_users_by_mobile = Utility::AssColumn($current_users, 'mobile');
$users = Users::GetUsers(NULL, 0, 50000);
global $g_user_type;
global $g_active_status;
foreach ($users as $i => $eu) {
if (!$current_users_by_mobile[$eu['mobile']]) {
$new_id = OutboundUsers::AddCommonUser(1, $eu);
$new_ids[] = $new_id;
//添加默认标签
if ($eu['user_type'] && $eu['user_type'] !== 'other') {
$gid = OutboundUserGroups::AddGroup(1, $g_user_type[$eu['user_type']]);
OutboundUserGroups::AddMap($new_id, $gid);
}
if ($eu['active_status']) {
$gid = OutboundUserGroups::AddGroup(1, $g_active_status[$eu['active_status']]);
OutboundUserGroups::AddMap($new_id, $gid);
}
$current_users_by_mobile[$eu['mobile']] = 1;
}
}
return $new_ids;
}
示例2: UpdateById
protected function UpdateById($args)
{
$object_id = $args[0];
$metas = $args[1];
$old_data = Utility::AssColumn($this->GetById(array($object_id)), 'meta_key');
foreach ($metas as $k => $v) {
if ($v && $v !== $old_data[$k]['meta_value']) {
$m = array();
if ($old_data[$k]) {
$m['id'] = $old_data[$k]['id'];
}
$m[$this->_fetch_id_name] = $object_id;
$m['meta_key'] = $k;
$m['meta_value'] = $v;
$new_data[] = $m;
}
}
if (!$new_data) {
return;
}
$mm = D($this->_table_name);
foreach ($new_data as $d) {
$mm->create($d);
$mm->saveOrUpdate();
}
return;
}
示例3: getTagsWeight
public function getTagsWeight($tag_type)
{
$sql = 'SELECT tag_id tag_id, name, COUNT(*) count
FROM jxdrcms_tag t, jxdrcms_tag_mapping tm
WHERE t.id = tm.tag_id and t.type_name = "' . $tag_type . '" GROUP BY tag_id';
$rs = Utility::AssColumn($this->query($sql, true), 'tag_id');
return $rs;
}
示例4: _after_select
function _after_select(&$resultSet, $options)
{
if ($resultSet) {
$creator_ids = Utility::GetColumn($resultSet, "create_user_id");
$users = M("Users")->where(array("id" => array("in", $creator_ids)))->select();
$users = Utility::AssColumn($users);
foreach ($resultSet as $index => $result) {
$resultSet[$index]['create_user_name'] = $users[$result['create_user_id']]['username'];
}
}
return $resultSet;
}
示例5: getQuestionAnswers
public function getQuestionAnswers($cms_user_id = 0, $type_id)
{
if ($type_id == 1) {
$f['recommend_id'] = $cms_user_id;
} else {
$f['cms_user_id'] = $cms_user_id;
}
$raw = Utility::AssColumn($this->where($f)->select(), 'question_id');
$questions = D("UserTypeQuestions")->gets($type_id, true);
foreach ($questions as $q) {
// 如果问题已经被删除,并且没有对应的填写过的答案,忽略之
if ($q['is_deleted'] && !$raw[$q['id']]['answer']) {
continue;
}
$res[$q['question']] = $raw[$q['id']]['answer'];
}
return $res;
}
示例6: render_dialog_edit
function render_dialog_edit()
{
$partner_id = $this->_param("id");
if (!$partner_id) {
return;
}
$partner = D('Partners')->getPartnerById($partner_id, 0);
$data['partner'] = $partner;
$data['all_tags'] = D('PartnerTags')->getTags($this->login_user['team_id']);
$data['tags'] = Utility::AssColumn($partner['tags'], 'partner_tag_id');
$data['title'] = $partner['title'];
// var_dump($data);
$data['modal_style'] = 'style="width:780px"';
$this->assign($data);
$html = $this->fetch('Partner:tag_editor_dialog');
$data = array(array("data" => $html, "type" => "dialog"), array("data" => "dialog_validator()", "type" => "eval"));
json($data, "mix");
}
示例7: GetTag
static function GetTag($tagname = 'dochead', $ass = null)
{
$xml = Config::Instance('xml');
$r = array();
if (!$xml->{$tagname}->item) {
return $r;
}
foreach ($xml->{$tagname}->item as $one) {
$attr = $one->attributes();
$pa = array();
foreach ($attr as $k => $v) {
$pa[strval($k)] = strval($v);
}
$r[] = $pa;
}
if ($ass) {
return Utility::AssColumn($r, 'id');
}
return $r;
}
示例8: option_category
}
Table::Delete('category', $id);
option_category($category['zone']);
Session::Set('notice', '删除分类成功');
json(null, 'refresh');
} else {
if ('teamcoupon' == $action) {
need_auth('team');
$team = Table::Fetch('team', $id);
team_state($team);
if ($team['now_number'] < $team['min_number']) {
json('团购未结束或未达到最低成团人数', 'alert');
}
/* all orders */
$all_orders = DB::LimitQuery('order', array('condition' => array('team_id' => $id, 'state' => 'pay')));
$all_orders = Utility::AssColumn($all_orders, 'id');
$all_order_ids = Utility::GetColumn($all_orders, 'id');
$all_order_ids = array_unique($all_order_ids);
/* all coupon id */
$coupon_sql = "SELECT order_id, count(1) AS count FROM coupon WHERE team_id = '{$id}' GROUP BY order_id";
$coupon_res = DB::GetQueryResult($coupon_sql, false);
$coupon_order_ids = Utility::GetColumn($coupon_res, 'order_id');
$coupon_order_ids = array_unique($coupon_order_ids);
/* miss id */
$miss_ids = array_diff($all_order_ids, $coupon_order_ids);
foreach ($coupon_res as $one) {
if ($one['count'] < $all_orders[$one['order_id']]['quantity']) {
$miss_ids[] = $one['order_id'];
}
}
$orders = Table::Fetch('order', $miss_ids);
示例9: GetDbRowById
static public function GetDbRowById($table, $ids=array()) {
$one = is_array($ids) ? false : true;
settype($ids, 'array');
$idstring = join('\',\'', $ids);
if(preg_match('/[\s]/', $idstring)) return array();
$q = "SELECT * FROM `{$table}` WHERE id IN ('{$idstring}')";
$r = self::GetQueryResult($q, $one);
if ($one) return $r;
return Utility::AssColumn($r, 'id');
}
示例10: getSchoolProjectsBySchoolId
public function getSchoolProjectsBySchoolId($school_id)
{
$map = D("SchoolProjectMapping")->order('id desc')->getsBySchoolId(intval($school_id));
$f['id'] = array('in', Utility::GetColumn($map, 'project_id'));
$projects = Utility::AssColumn(D("Projects")->where($f)->select());
foreach ($map as $k => $v) {
$map[$k]['project'] = $projects[$v['project_id']];
}
return $map;
}
示例11: DBFetch
public static function DBFetch($n = null, $ids = array(), $k = 'id', $db = null)
{
if (empty($ids)) {
return array();
}
settype($ids, 'array');
$ids = array_values($ids);
$ids = array_diff($ids, array(NULL));
if (is_object($db)) {
$result = $db->LimitQuery($n, array('condition' => array($k => $ids)));
} else {
$result = DB::LimitQuery($n, array('condition' => array($k => $ids)));
}
$result = Utility::AssColumn($result, $k);
/*
if ( 'id' === $k )
{
$key = Memcache::GetObjectKey($n, $ids, $k);
$memcache = Memcache::Instance();
foreach( $key AS $id => $c_key )
{
if ( isset($result[$id]) )
$memcache->Set($c_key, $result[$id]);
}
}
*/
return $result;
}
示例12: GetObject
static function GetObject($tablename, $id)
{
$single = !is_array($id);
settype($id, 'array');
$k = array();
foreach ($id as $oid) {
$k[] = self::GetObjectKey($tablename, $oid);
}
$r = Utility::AssColumn(self::Get($k), 'id');
return $single ? array_pop($r) : $r;
}
示例13: option_p_category
function option_p_category($zone = 'city', $force = false, $all = false)
{
$cache = $force ? 0 : 86400 * 30;
$cates = DB::LimitQuery('category', array('condition' => array('zone' => $zone, 'parent_id is null'), 'order' => 'ORDER BY sort_order DESC, id DESC', 'cache' => $cache));
$cates = Utility::AssColumn($cates, 'id');
return $all ? $cates : Utility::OptionArray($cates, 'id', 'name');
}
示例14: _handle_upload
private function _handle_upload()
{
$attachments = $this->_param("attachments");
if ($attachments) {
$exists = Utility::AssColumn(D("UserAttachments")->where('user_id=' . intval($this->login_user['id']))->field('path')->select(), 'path');
$attachments = explode('||', $attachments);
foreach ($attachments as $attachment) {
$attach_info = explode(",", $attachment);
if ($exists[$attach_info[0]]) {
continue;
}
$attachment_infos[] = $attach_info;
$file = array("path" => $attach_info[0], "title" => $attach_info[1], "size" => $attach_info[2], "create_user_id" => $this->login_user['id'], "user_id" => $this->userinfo['recommend_info']['id'], "create_time" => date('Y-m-d H:i:s'), "type" => 'user', "dir_id" => intval($this->_param('dir_id' . $attach_info[3])));
D("UserAttachments")->add($file);
}
}
return $attachment_infos;
}
示例15: GetDbRowById
public static function GetDbRowById($table, $ids = array())
{
$one = is_array($ids) ? false : true;
settype($ids, 'array');
if (preg_match('/[^\\w\\-\\_]/', implode('', $ids))) {
return array();
}
$idstring = implode("','", $ids);
$q = "SELECT * FROM `{$table}` WHERE id IN ('{$idstring}')";
$r = self::GetQueryResult($q, $one);
if ($one) {
return $r;
}
return Utility::AssColumn($r, 'id');
}